diff options
author | Tim Oram <dev@mitmaro.ca> | 2022-02-09 09:53:56 -0330 |
---|---|---|
committer | Tim Oram <dev@mitmaro.ca> | 2022-02-09 10:20:26 -0330 |
commit | 8330b5cb8385c06bf8d281e035dd51728d4fe8b6 (patch) | |
tree | 39dbee4b028a9e101bfdf6562ae3515b0aaefb2b | |
parent | 2a0723844d82c2e804fd43e210e0d2b2dbf234fb (diff) |
Fix disabled lints in the core crate
-rw-r--r-- | src/core/src/lib.rs | 14 | ||||
-rw-r--r-- | src/core/src/module/modules.rs | 3 | ||||
-rw-r--r-- | src/core/src/modules/external_editor/argument_tokenizer.rs | 2 | ||||
-rw-r--r-- | src/core/src/modules/insert/mod.rs | 1 | ||||
-rw-r--r-- | src/core/src/modules/list/mod.rs | 1 | ||||
-rw-r--r-- | src/core/src/modules/list/utils.rs | 2 | ||||
-rw-r--r-- | src/core/src/modules/show_commit/mod.rs | 2 | ||||
-rw-r--r-- | src/core/src/modules/show_commit/util.rs | 10 | ||||
-rw-r--r-- | src/core/src/modules/show_commit/view_builder.rs | 4 |
9 files changed, 21 insertions, 18 deletions
diff --git a/src/core/src/lib.rs b/src/core/src/lib.rs index c7f4934..df5e811 100644 --- a/src/core/src/lib.rs +++ b/src/core/src/lib.rs @@ -73,20 +73,12 @@ )] // LINT-REPLACE-END #![allow( - missing_docs, - rustdoc::missing_crate_level_docs, clippy::as_conversions, clippy::cast_possible_truncation, - clippy::else_if_without_else, - clippy::indexing_slicing, - clippy::integer_division, - clippy::non_ascii_literal, - clippy::panic, clippy::redundant_closure_for_method_calls, - clippy::too_many_lines, - clippy::unreachable, - clippy::unwrap_used, - clippy::wildcard_enum_match_arm + clippy::wildcard_enum_match_arm, + missing_docs, + rustdoc::missing_crate_level_docs )] mod arguments; diff --git a/src/core/src/module/modules.rs b/src/core/src/module/modules.rs index 2c78a88..75aaf38 100644 --- a/src/core/src/module/modules.rs +++ b/src/core/src/module/modules.rs @@ -21,10 +21,11 @@ impl<'m> Modules<'m> { let _previous = self.modules.insert(state, Box::new(module)); } + #[allow(clippy::panic)] fn get_mut_module(&mut self, state: State) -> &mut Box<dyn Module + 'm> { self.modules .get_mut(&state) - .unwrap_or_else(|| panic!("Invalid module for provided state: {:?}", state)) + .unwrap_or_else(|| panic!("Invalid module for provided state: {:?}. Please report.", state)) } pub(crate) fn activate(&mut self, state: State, rebase_todo: &TodoFile, previous_state: State) -> ProcessResult { diff --git a/src/core/src/modules/external_editor/argument_tokenizer.rs b/src/core/src/modules/external_editor/argument_tokenizer.rs index 390a5c3..5a772c5 100644 --- a/src/core/src/modules/external_editor/argument_tokenizer.rs +++ b/src/core/src/modules/external_editor/argument_tokenizer.rs @@ -10,7 +10,7 @@ enum State { } // as far as I know, this is safe because the slices are always on specific boundaries -#[allow(clippy::string_slice)] +#[allow(clippy::string_slice, clippy::indexing_slicing)] pub(super) fn tokenize(input: &str) -> Option<Vec<String>> { let mut previous_state = State::Normal; let mut state = State::Normal; diff --git a/src/core/src/modules/insert/mod.rs b/src/core/src/modules/insert/mod.rs index 1efcf69..d584590 100644 --- a/src/core/src/modules/insert/mod.rs +++ b/src/core/src/modules/insert/mod.rs @@ -57,6 +57,7 @@ impl Module for Insert { } } + #[allow(clippy::unreachable)] fn handle_event(&mut self, event: Event, view_sender: &ViewSender, rebase_todo: &mut TodoFile) -> ProcessResult { match self.state { InsertState::Prompt => { diff --git a/src/core/src/modules/list/mod.rs b/src/core/src/modules/list/mod.rs index e196946..8277b82 100644 --- a/src/core/src/modules/list/mod.rs +++ b/src/core/src/modules/list/mod.rs @@ -235,6 +235,7 @@ impl List { } } + #[allow(clippy::integer_division)] fn handle_common_list_input( &mut self, event: Event, diff --git a/src/core/src/modules/list/utils.rs b/src/core/src/modules/list/utils.rs index 2547b82..7cd5ce3 100644 --- a/src/core/src/modules/list/utils.rs +++ b/src/core/src/modules/list/utils.rs @@ -202,7 +202,7 @@ const fn get_action_color(action: Action) -> DisplayColor { } // safe slice, as it is only on the hash, which is hexadecimal -#[allow(clippy::string_slice)] +#[allow(clippy::string_slice, clippy::indexing_slicing)] pub(super) fn get_todo_line_segments( line: &Line, is_cursor_line: bool, diff --git a/src/core/src/modules/show_commit/mod.rs b/src/core/src/modules/show_commit/mod.rs index a0e4d75..1b2086d 100644 --- a/src/core/src/modules/show_commit/mod.rs +++ b/src/core/src/modules/show_commit/mod.rs @@ -87,7 +87,7 @@ impl Module for ShowCommit<'_> { return self.help.get_view_data(); } - let diff = self.diff.as_ref().unwrap(); // will only fail on programmer error + let diff = self.diff.as_ref().expect("Diff ref unwrap failed"); // will only fail on programmer error let state = &self.state; let view_builder = &self.view_builder; let is_full_width = context.is_full_width(); diff --git a/src/core/src/modules/show_commit/util.rs b/src/core/src/modules/show_commit/util.rs index 638bf0c..19f5d43 100644 --- a/src/core/src/modules/show_commit/util.rs +++ b/src/core/src/modules/show_commit/util.rs @@ -7,6 +7,9 @@ use num_format::{Locale, ToFormattedString}; use unicode_segmentation::UnicodeSegmentation; use view::{LineSegment, ViewLine}; +const TO_FILE_INDICATOR_LONG: &str = " \u{2192} "; // " → " +const TO_FILE_INDICATOR_SHORT: &str = "\u{2192}"; // "→" + pub(super) fn get_show_commit_help_lines(key_bindings: &KeyBindings) -> Vec<(Vec<String>, String)> { vec![ (key_bindings.move_up.clone(), String::from("Scroll up")), @@ -62,7 +65,12 @@ pub(super) fn get_stat_item_segments( Status::Other => DisplayColor::Normal, }; - let to_file_indicator = if is_full_width { " → " } else { "→" }; + let to_file_indicator = if is_full_width { + TO_FILE_INDICATOR_LONG + } + else { + TO_FILE_INDICATOR_SHORT + }; match status { Status::Copied => { diff --git a/src/core/src/modules/show_commit/view_builder.rs b/src/core/src/modules/show_commit/view_builder.rs index e5ffb0d..0011598 100644 --- a/src/core/src/modules/show_commit/view_builder.rs +++ b/src/core/src/modules/show_commit/view_builder.rs @@ -62,7 +62,7 @@ impl ViewBuilder { } // safe slice, as it is only on the hash, which is hexadecimal - #[allow(clippy::string_slice)] + #[allow(clippy::string_slice, clippy::indexing_slicing)] fn build_leading_summary(commit: &Commit, is_full_width: bool) -> ViewLine { let mut segments = vec![]; if is_full_width { @@ -154,7 +154,7 @@ impl ViewBuilder { } // safe slice, only slices across graphemes whitespace - #[allow(clippy::string_slice)] + #[allow(clippy::string_slice, clippy::indexing_slicing)] fn get_diff_line_segments( &self, diff_line: &DiffLine, |