diff options
author | Tim Oram <dev@mitmaro.ca> | 2019-10-17 21:42:56 -0230 |
---|---|---|
committer | Tim Oram <dev@mitmaro.ca> | 2019-12-27 13:30:32 -0330 |
commit | a5ddc401a7b942cdde9f5282579a89c71d368147 (patch) | |
tree | d734912c33e3f579eb9f35d83ca3145e93ebda60 | |
parent | a0c983d522fba03ec2eef21a20f97c6c26592b66 (diff) |
Enable trivial numeric cast linting rule
-rw-r--r-- | src/main.rs | 3 | ||||
-rw-r--r-- | src/scroll/scroll_position.rs | 8 | ||||
-rw-r--r-- | src/show_commit/show_commit.rs | 2 |
3 files changed, 6 insertions, 7 deletions
diff --git a/src/main.rs b/src/main.rs index 0a2b0b2..e0b6db4 100644 --- a/src/main.rs +++ b/src/main.rs @@ -8,8 +8,7 @@ #![allow(missing_docs)] #![allow(single_use_lifetimes)] #![deny(trivial_casts)] -// TODO enable this linting rule -#![allow(trivial_numeric_casts)] +#![deny(trivial_numeric_casts)] // TODO enable this linting rule #![allow(unreachable_pub)] #![deny(unsafe_code)] diff --git a/src/scroll/scroll_position.rs b/src/scroll/scroll_position.rs index e75272a..54b34f0 100644 --- a/src/scroll/scroll_position.rs +++ b/src/scroll/scroll_position.rs @@ -12,10 +12,10 @@ impl ScrollPosition { pub fn new(padding: usize, big_scroll: usize, small_scroll: usize) -> Self { Self { big_scroll, - left_value: RefCell::new(0 as usize), + left_value: RefCell::new(0), padding, small_scroll, - top_value: RefCell::new(0 as usize), + top_value: RefCell::new(0), } } @@ -59,7 +59,7 @@ impl ScrollPosition { } pub fn ensure_cursor_visible(&self, cursor: usize, window_height: usize, lines_length: usize) { - let view_height = window_height as usize - self.padding; + let view_height = window_height - self.padding; let current_value = *self.top_value.borrow(); @@ -90,7 +90,7 @@ impl ScrollPosition { } fn update_top(&self, scroll_up: bool, window_height: usize, lines_length: usize) { - let view_height = window_height as usize - self.padding; + let view_height = window_height - self.padding; if view_height >= lines_length { self.reset(); diff --git a/src/show_commit/show_commit.rs b/src/show_commit/show_commit.rs index 810053e..4135764 100644 --- a/src/show_commit/show_commit.rs +++ b/src/show_commit/show_commit.rs @@ -77,7 +77,7 @@ impl ProcessModule for ShowCommit { }, Input::Resize => { self.scroll_position - .scroll_up(view_height as usize, self.get_commit_stats_length()); + .scroll_up(view_height, self.get_commit_stats_length()); }, _ => { result = result.state(State::List(false)); |