From f733e4dced9945bbfb3714207786cc2d6e069480 Mon Sep 17 00:00:00 2001 From: xehpuk Date: Sat, 30 Dec 2023 16:46:29 +0100 Subject: [PATCH] Replace `checked_sub().unwrap_or(0)` with `saturating_sub()` --- src/client.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/client.rs b/src/client.rs index e8f03a7..2c6fe80 100644 --- a/src/client.rs +++ b/src/client.rs @@ -176,7 +176,7 @@ impl ChatLog { fn render(&mut self, buffer: &mut Buffer, boundary: Rect) { let n = self.items.len(); - let m = n.checked_sub(boundary.h).unwrap_or(0); + let m = n.saturating_sub(boundary.h); for (dy, (line, color)) in self.items.iter().skip(m).enumerate() { let line_chars: Vec<_> = line.chars().collect(); buffer.put_cells(