summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorClement Tsang <34804052+ClementTsang@users.noreply.github.com>2021-04-23 00:06:07 -0400
committerGitHub <noreply@github.com>2021-04-23 00:06:07 -0400
commit0148432b15fded2a87ed0fccbd28e3eb2aa71729 (patch)
treef60f4a2119d175d510d3bbf85be32f8064e55bf5 /src
parentf33bb42c5b234183117fa30d87b1fe6d9ab94d69 (diff)
refactor: Take clippy nightly suggestions into account (#456)
Refactor in regards to clippy nightly. Mostly deals with suggestions with duplicate code on multiple branches.
Diffstat (limited to 'src')
-rw-r--r--src/canvas/dialogs/help_dialog.rs6
-rw-r--r--src/canvas/drawing_utils.rs14
2 files changed, 6 insertions, 14 deletions
diff --git a/src/canvas/dialogs/help_dialog.rs b/src/canvas/dialogs/help_dialog.rs
index b3c9f579..2e6dd7d8 100644
--- a/src/canvas/dialogs/help_dialog.rs
+++ b/src/canvas/dialogs/help_dialog.rs
@@ -57,8 +57,6 @@ impl HelpDialog for Painter {
});
app_state.help_dialog_state.index_shortcuts[itx] = 0;
- prev_section_len = section.len() as u16 + buffer;
- overflow_buffer += buffer;
} else {
section.iter().for_each(|text_line| {
buffer += UnicodeWidthStr::width(*text_line).saturating_sub(1) as u16
@@ -69,9 +67,9 @@ impl HelpDialog for Painter {
app_state.help_dialog_state.index_shortcuts[itx - 1]
+ 1
+ prev_section_len;
- prev_section_len = section.len() as u16 + buffer;
- overflow_buffer += buffer;
}
+ prev_section_len = section.len() as u16 + buffer;
+ overflow_buffer += buffer;
});
app_state.help_dialog_state.scroll_state.max_scroll_index =
diff --git a/src/canvas/drawing_utils.rs b/src/canvas/drawing_utils.rs
index 6aee1aa7..ee81127a 100644
--- a/src/canvas/drawing_utils.rs
+++ b/src/canvas/drawing_utils.rs
@@ -151,14 +151,11 @@ pub fn get_search_start_position(
if current_cursor_position <= *cursor_bar {
// If it's past the first element, then show from that element downwards
*cursor_bar = current_cursor_position;
- *cursor_bar
} else if current_cursor_position >= *cursor_bar + num_columns {
*cursor_bar = current_cursor_position - num_columns;
- *cursor_bar
- } else {
- // Else, don't change what our start position is from whatever it is set to!
- *cursor_bar
}
+ // Else, don't change what our start position is from whatever it is set to!
+ *cursor_bar
}
}
}
@@ -191,14 +188,11 @@ pub fn get_start_position(
if currently_selected_position <= *scroll_position_bar {
// If it's past the first element, then show from that element downwards
*scroll_position_bar = currently_selected_position;
- *scroll_position_bar
} else if currently_selected_position >= *scroll_position_bar + num_rows {
*scroll_position_bar = currently_selected_position - num_rows;
- *scroll_position_bar
- } else {
- // Else, don't change what our start position is from whatever it is set to!
- *scroll_position_bar
}
+ // Else, don't change what our start position is from whatever it is set to!
+ *scroll_position_bar
}
}
}