diff --git a/src/fs/dir.rs b/src/fs/dir.rs index 7f7b067..1a6ce01 100644 --- a/src/fs/dir.rs +++ b/src/fs/dir.rs @@ -121,9 +121,8 @@ impl<'dir, 'ig> Files<'dir, 'ig> { return Some(File::from_args(path.clone(), self.dir, filename) .map_err(|e| (path.clone(), e))) } - else { - return None - } + + return None } } } diff --git a/src/fs/filter.rs b/src/fs/filter.rs index 4cd6ad2..08770e6 100644 --- a/src/fs/filter.rs +++ b/src/fs/filter.rs @@ -284,8 +284,10 @@ impl SortField { } fn strip_dot(n: &str) -> &str { - if n.starts_with('.') { &n[1..] } - else { n } + match n.strip_prefix('.') { + Some(s) => s, + None => n, + } } } diff --git a/src/info/filetype.rs b/src/info/filetype.rs index 8f54281..1def7a2 100644 --- a/src/info/filetype.rs +++ b/src/info/filetype.rs @@ -19,6 +19,7 @@ impl FileExtensions { /// An “immediate” file is something that can be run or activated somehow /// in order to kick off the build of a project. It’s usually only present /// in directories full of source code. + #[allow(clippy::case_sensitive_file_extension_comparisons)] fn is_immediate(&self, file: &File<'_>) -> bool { file.name.to_lowercase().starts_with("readme") || file.name.ends_with(".ninja") || diff --git a/src/main.rs b/src/main.rs index 84f36b7..4d762b5 100644 --- a/src/main.rs +++ b/src/main.rs @@ -8,7 +8,6 @@ #![warn(clippy::all, clippy::pedantic)] #![allow(clippy::enum_glob_use)] -#![allow(clippy::find_map)] #![allow(clippy::map_unwrap_or)] #![allow(clippy::match_same_arms)] #![allow(clippy::missing_const_for_fn)] @@ -19,6 +18,7 @@ #![allow(clippy::option_if_let_else)] #![allow(clippy::too_many_lines)] #![allow(clippy::unused_self)] +#![allow(clippy::upper_case_acronyms)] #![allow(clippy::wildcard_imports)] use std::env; diff --git a/src/options/mod.rs b/src/options/mod.rs index 747213b..528ba43 100644 --- a/src/options/mod.rs +++ b/src/options/mod.rs @@ -178,7 +178,7 @@ impl Options { fn deduce(matches: &MatchedFlags<'_>, vars: &V) -> Result { if cfg!(not(feature = "git")) && matches.has_where_any(|f| f.matches(&flags::GIT) || f.matches(&flags::GIT_IGNORE)).is_some() { - return Err(OptionsError::Unsupported(format!( + return Err(OptionsError::Unsupported(String::from( "Options --git and --git-ignore can't be used because `git` feature was disabled in this build of exa" ))); } diff --git a/src/options/view.rs b/src/options/view.rs index 6d7abac..fe42838 100644 --- a/src/options/view.rs +++ b/src/options/view.rs @@ -57,10 +57,9 @@ impl Mode { let grid_details = grid_details::Options { grid, details, row_threshold }; return Ok(Self::GridDetails(grid_details)); } - else { - // the --tree case is handled by the DirAction parser later - return Ok(Self::Details(details)); - } + + // the --tree case is handled by the DirAction parser later + return Ok(Self::Details(details)); } Self::strict_check_long_flags(matches)?; diff --git a/src/output/escape.rs b/src/output/escape.rs index b4e801d..4c9f86c 100644 --- a/src/output/escape.rs +++ b/src/output/escape.rs @@ -1,7 +1,7 @@ use ansi_term::{ANSIString, Style}; -pub fn escape<'a>(string: String, bits: &mut Vec>, good: Style, bad: Style) { +pub fn escape(string: String, bits: &mut Vec>, good: Style, bad: Style) { if string.chars().all(|c| c >= 0x20 as char && c != 0x7f as char) { bits.push(good.paint(string)); return; diff --git a/src/output/icons.rs b/src/output/icons.rs index 8c024dc..eea0286 100644 --- a/src/output/icons.rs +++ b/src/output/icons.rs @@ -37,7 +37,7 @@ impl Icons { /// - If neither is set, just use the default style. /// - Attributes such as bold or underline should not be used to paint the /// icon, as they can make it look weird. -pub fn iconify_style<'a>(style: Style) -> Style { +pub fn iconify_style(style: Style) -> Style { style.background.or(style.foreground) .map(Style::from) .unwrap_or_default() diff --git a/src/output/render/git.rs b/src/output/render/git.rs index 7ec9589..3740d40 100644 --- a/src/output/render/git.rs +++ b/src/output/render/git.rs @@ -35,6 +35,7 @@ impl f::GitStatus { pub trait Colours { fn not_modified(&self) -> Style; + #[allow(clippy::new_ret_no_self)] fn new(&self) -> Style; fn modified(&self) -> Style; fn deleted(&self) -> Style; diff --git a/src/output/table.rs b/src/output/table.rs index fbe716c..1680ec7 100644 --- a/src/output/table.rs +++ b/src/output/table.rs @@ -28,6 +28,7 @@ pub struct Options { } /// Extra columns to display in the table. +#[allow(clippy::struct_excessive_bools)] #[derive(PartialEq, Debug, Copy, Clone)] pub struct Columns { @@ -166,6 +167,7 @@ impl Column { /// Formatting options for file sizes. +#[allow(clippy::pub_enum_variant_names)] #[derive(PartialEq, Debug, Copy, Clone)] pub enum SizeFormat { @@ -303,11 +305,11 @@ impl Environment { fn determine_time_zone() -> TZResult { if let Ok(file) = env::var("TZ") { TimeZone::from_file({ - if file.starts_with("/") { + if file.starts_with('/') { file } else { format!("/usr/share/zoneinfo/{}", { - if file.starts_with(":") { + if file.starts_with(':') { file.replacen(":", "", 1) } else { file