diff options
-rw-r--r-- | src/config/src/utils/get_string.rs | 5 | ||||
-rw-r--r-- | src/core/build.rs | 2 | ||||
-rw-r--r-- | src/core/src/application.rs | 2 | ||||
-rw-r--r-- | src/core/src/components/choice/mod.rs | 6 | ||||
-rw-r--r-- | src/core/src/components/help/mod.rs | 3 | ||||
-rw-r--r-- | src/display/src/error.rs | 3 | ||||
-rw-r--r-- | src/runtime/src/testutils/mod.rs | 7 | ||||
-rw-r--r-- | src/runtime/src/thread_statuses.rs | 3 | ||||
-rw-r--r-- | src/todo_file/src/errors/io.rs | 5 |
9 files changed, 18 insertions, 18 deletions
diff --git a/src/config/src/utils/get_string.rs b/src/config/src/utils/get_string.rs index 74d44e2..712d00f 100644 --- a/src/config/src/utils/get_string.rs +++ b/src/config/src/utils/get_string.rs @@ -3,9 +3,8 @@ use git::{Config, ErrorCode}; use crate::{ConfigError, ConfigErrorCause}; pub(crate) fn _get_string(config: Option<&Config>, name: &str) -> Result<Option<String>, ConfigError> { - let cfg = match config { - None => return Ok(None), - Some(c) => c, + let Some(cfg) = config else { + return Ok(None); }; match cfg.get_string(name) { Ok(v) => Ok(Some(v)), diff --git a/src/core/build.rs b/src/core/build.rs index bbc8dd7..b8b88bc 100644 --- a/src/core/build.rs +++ b/src/core/build.rs @@ -14,7 +14,7 @@ fn main() { // Make the current git hash available to the build if let Some(rev) = git_revision_hash() { - println!("cargo:rustc-env=GIRT_BUILD_GIT_HASH={}", rev); + println!("cargo:rustc-env=GIRT_BUILD_GIT_HASH={rev}"); } println!("cargo:rustc-env=GIRT_BUILD_DATE={}", Utc::now().format("%Y-%m-%d")); } diff --git a/src/core/src/application.rs b/src/core/src/application.rs index f9590b5..ded15b8 100644 --- a/src/core/src/application.rs +++ b/src/core/src/application.rs @@ -61,7 +61,7 @@ where .key_bindings .help .first() - .map_or(String::from("?"), String::from) + .map_or_else(|| String::from("?"), String::from) .as_str(), ); diff --git a/src/core/src/components/choice/mod.rs b/src/core/src/components/choice/mod.rs index 2ac6c0f..8e775a5 100644 --- a/src/core/src/components/choice/mod.rs +++ b/src/core/src/components/choice/mod.rs @@ -24,10 +24,11 @@ pub(crate) struct Choice<T> { impl<T> Choice<T> where T: Clone { + #[allow(clippy::pattern_type_mismatch)] pub(crate) fn new(options: Vec<(T, char, String)>) -> Self { let map = options .iter() - .map(|&(ref v, ref k, _)| { + .map(|(v, k, _)| { let c = *k; let t = v.clone(); (c, t) @@ -54,12 +55,13 @@ where T: Clone }); } + #[allow(clippy::pattern_type_mismatch)] pub(crate) fn get_view_data(&mut self) -> &ViewData { let options = &self.options; let invalid_selection = self.invalid_selection; self.view_data.update_view_data(|updater| { updater.clear_body(); - for &(_, ref key, ref description) in options { + for (_, key, description) in options { updater.push_line(ViewLine::from(format!("{key}) {description}"))); } updater.push_line(ViewLine::new_empty_line()); diff --git a/src/core/src/components/help/mod.rs b/src/core/src/components/help/mod.rs index c48313b..86ed30c 100644 --- a/src/core/src/components/help/mod.rs +++ b/src/core/src/components/help/mod.rs @@ -18,9 +18,10 @@ pub(crate) struct Help { } impl Help { + #[allow(clippy::pattern_type_mismatch)] fn get_max_help_key_length(lines: &[(Vec<String>, String)]) -> usize { let mut max_length = 0; - for &(ref key, _) in lines { + for (key, _) in lines { let combined_key = key.join(", "); let len = UnicodeSegmentation::graphemes(combined_key.as_str(), true).count(); if len > max_length { diff --git a/src/display/src/error.rs b/src/display/src/error.rs index 2d28f82..7f8e952 100644 --- a/src/display/src/error.rs +++ b/src/display/src/error.rs @@ -13,9 +13,10 @@ pub enum DisplayError { impl PartialEq for DisplayError { #[inline] + #[allow(clippy::pattern_type_mismatch)] fn eq(&self, other: &Self) -> bool { match (self, other) { - (&Self::Unexpected(ref self_io_error), &Self::Unexpected(ref other_io_error)) => { + (Self::Unexpected(self_io_error), Self::Unexpected(other_io_error)) => { self_io_error.kind() == other_io_error.kind() }, } diff --git a/src/runtime/src/testutils/mod.rs b/src/runtime/src/testutils/mod.rs index fde212d..86f9d83 100644 --- a/src/runtime/src/testutils/mod.rs +++ b/src/runtime/src/testutils/mod.rs @@ -114,9 +114,7 @@ impl ThreadableTester { } assert!( attempt <= 100, - "Timeout waited for status change to '{:?}' on thread.\n Status is: {:?}", - status, - current_status, + "Timeout waited for status change to '{status:?}' on thread.\n Status is: {current_status:?}", ); sleep(WAIT_TIME); @@ -142,8 +140,7 @@ impl ThreadableTester { } assert!( attempt <= 100, - "Timeout waited for status change to 'Status::Error(_)' on thread.\n Status is: {:?}", - current_status, + "Timeout waited for status change to 'Status::Error(_)' on thread.\n Status is: {current_status:?}" ); sleep(WAIT_TIME); diff --git a/src/runtime/src/thread_statuses.rs b/src/runtime/src/thread_statuses.rs index 4410507..02dc676 100644 --- a/src/runtime/src/thread_statuses.rs +++ b/src/runtime/src/thread_statuses.rs @@ -53,8 +53,7 @@ impl ThreadStatuses { pub(crate) fn register_thread(&self, thread_name: &str, status: Status) { assert!( self.statuses.lock().insert(String::from(thread_name), status).is_none(), - "Attempt to register more than one threads with name: {}", - thread_name + "Attempt to register more than one threads with name: {thread_name}" ); } diff --git a/src/todo_file/src/errors/io.rs b/src/todo_file/src/errors/io.rs index 9042a7e..86b8d22 100644 --- a/src/todo_file/src/errors/io.rs +++ b/src/todo_file/src/errors/io.rs @@ -19,10 +19,11 @@ pub enum FileReadErrorCause { impl PartialEq for FileReadErrorCause { #[inline] + #[allow(clippy::pattern_type_mismatch)] fn eq(&self, other: &Self) -> bool { match (self, other) { - (&Self::IoError(ref self_err), &Self::IoError(ref other_err)) => self_err.kind() == other_err.kind(), - (&Self::ParseError(ref self_err), &Self::ParseError(ref other_err)) => self_err == other_err, + (Self::IoError(self_err), Self::IoError(other_err)) => self_err.kind() == other_err.kind(), + (Self::ParseError(self_err), Self::ParseError(other_err)) => self_err == other_err, _ => false, } } |