1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2025-07-30 04:27:45 +00:00

fix rustfmt+clippy

This commit is contained in:
Sylvestre Ledru 2024-12-03 22:45:00 +01:00
parent b2510feb46
commit c1f82b158c

View file

@ -469,23 +469,19 @@ impl<'a> Pager<'a> {
fn should_close(&mut self) -> bool { fn should_close(&mut self) -> bool {
self.upper_mark self.upper_mark
.saturating_add(self.content_rows.into()) .saturating_add(self.content_rows)
.ge(&self.line_count) .ge(&self.line_count)
} }
fn page_down(&mut self) { fn page_down(&mut self) {
// If the next page down position __after redraw__ is greater than the total line count, // If the next page down position __after redraw__ is greater than the total line count,
// the upper mark must not grow past top of the screen at the end of the open file. // the upper mark must not grow past top of the screen at the end of the open file.
if self if self.upper_mark.saturating_add(self.content_rows * 2) >= self.line_count {
.upper_mark
.saturating_add(self.content_rows * 2)
>= self.line_count
{
self.upper_mark = self.line_count - self.content_rows; self.upper_mark = self.line_count - self.content_rows;
return; return;
} }
self.upper_mark = self.upper_mark.saturating_add(self.content_rows.into()); self.upper_mark = self.upper_mark.saturating_add(self.content_rows);
} }
fn page_up(&mut self) { fn page_up(&mut self) {
@ -524,7 +520,7 @@ impl<'a> Pager<'a> {
self.draw_lines(stdout); self.draw_lines(stdout);
let lower_mark = self let lower_mark = self
.line_count .line_count
.min(self.upper_mark.saturating_add(self.content_rows.into())); .min(self.upper_mark.saturating_add(self.content_rows));
self.draw_prompt(stdout, lower_mark, wrong_key); self.draw_prompt(stdout, lower_mark, wrong_key);
stdout.flush().unwrap(); stdout.flush().unwrap();
} }