diff --git a/src/fs/feature/git.rs b/src/fs/feature/git.rs index c49cbb9..490f18b 100644 --- a/src/fs/feature/git.rs +++ b/src/fs/feature/git.rs @@ -121,7 +121,7 @@ impl GitRepo { /// /// The temporary `Processing` enum variant is used after the `git2` /// repository is moved out, but before the results have been moved in! - /// See https://stackoverflow.com/q/45985827/3484614 + /// See fn search(&self, index: &Path, prefix_lookup: bool) -> f::Git { use std::mem::replace; @@ -161,8 +161,9 @@ impl GitRepo { } }; - match repo.workdir().map(|wd| wd.to_path_buf()) { + match repo.workdir() { Some(workdir) => { + let workdir = workdir.to_path_buf(); let contents = Mutex::new(GitContents::Before { repo }); Ok(Self { contents, workdir, original_path: path, extra_paths: Vec::new() }) }, diff --git a/src/fs/feature/xattr.rs b/src/fs/feature/xattr.rs index d028e17..ea718b4 100644 --- a/src/fs/feature/xattr.rs +++ b/src/fs/feature/xattr.rs @@ -66,7 +66,7 @@ pub fn list_attrs(lister: &lister::Lister, path: &Path) -> io::Result {}, } - let mut buf = vec![0u8; bufsize as usize]; + let mut buf = vec![0_u8; bufsize as usize]; let err = lister.listxattr_second(&c_path, &mut buf, bufsize); match err.cmp(&0) { diff --git a/src/fs/fields.rs b/src/fs/fields.rs index 397fd21..4d3cb86 100644 --- a/src/fs/fields.rs +++ b/src/fs/fields.rs @@ -169,8 +169,8 @@ pub enum Size { /// The major and minor device IDs that gets displayed for device files. /// /// You can see what these device numbers mean: -/// - http://www.lanana.org/docs/device-list/ -/// - http://www.lanana.org/docs/device-list/devices-2.6+.txt +/// - +/// - #[derive(Copy, Clone)] pub struct DeviceIDs { pub major: u8, diff --git a/src/fs/filter.rs b/src/fs/filter.rs index 937caff..26c5385 100644 --- a/src/fs/filter.rs +++ b/src/fs/filter.rs @@ -96,7 +96,7 @@ impl FileFilter { files.retain(|f| !self.ignore_patterns.is_ignored(&f.name)); if self.only_dirs { - files.retain(|f| f.is_directory()); + files.retain(File::is_directory); } } @@ -306,8 +306,8 @@ impl FromIterator for IgnorePatterns { impl IgnorePatterns { /// Create a new list from the input glob strings, turning the inputs that - /// are valid glob patterns into an IgnorePatterns. The inputs that don’t - /// parse correctly are returned separately. + /// are valid glob patterns into an `IgnorePatterns`. The inputs that + /// don’t parse correctly are returned separately. pub fn parse_from_iter<'a, I: IntoIterator>(iter: I) -> (Self, Vec) { let iter = iter.into_iter(); diff --git a/src/options/misfire.rs b/src/options/misfire.rs index d93abac..b42294b 100644 --- a/src/options/misfire.rs +++ b/src/options/misfire.rs @@ -55,11 +55,7 @@ impl Misfire { /// The OS return code this misfire should signify. pub fn is_error(&self) -> bool { - match self { - Self::Help(_) | - Self::Version(_) => false, - _ => true, - } + ! matches!(self, Self::Help(_) | Self::Version(_)) } } diff --git a/src/options/parser.rs b/src/options/parser.rs index 3047eeb..99f5ab8 100644 --- a/src/options/parser.rs +++ b/src/options/parser.rs @@ -38,9 +38,9 @@ use crate::options::Misfire; pub type ShortArg = u8; /// A **long argument** is a string. This can be a UTF-8 string, even though -/// the arguments will all be unchecked OsStrings, because we don’t actually -/// store the user’s input after it’s been matched to a flag, we just store -/// which flag it was. +/// the arguments will all be unchecked `OsString` values, because we don’t +/// actually store the user’s input after it’s been matched to a flag, we just +/// store which flag it was. pub type LongArg = &'static str; /// A **list of values** that an option can have, to be displayed when the diff --git a/src/options/style.rs b/src/options/style.rs index 46d80c9..1dbddbc 100644 --- a/src/options/style.rs +++ b/src/options/style.rs @@ -117,11 +117,11 @@ impl Styles { } } -/// Parse the environment variables into LS_COLORS pairs, putting file glob +/// Parse the environment variables into `LS_COLORS` pairs, putting file glob /// colours into the `ExtensionMappings` that gets returned, and using the /// two-character UI codes to modify the mutable `Colours`. /// -/// Also returns if the EXA_COLORS variable should reset the existing file +/// Also returns if the `EXA_COLORS` variable should reset the existing file /// type mappings or not. The `reset` code needs to be the first one. fn parse_color_vars(vars: &V, colours: &mut Colours) -> (ExtensionMappings, bool) { use log::*; diff --git a/src/options/vars.rs b/src/options/vars.rs index 4e14237..3657214 100644 --- a/src/options/vars.rs +++ b/src/options/vars.rs @@ -18,7 +18,7 @@ pub static TIME_STYLE: &str = "TIME_STYLE"; // exa-specific variables /// Environment variable used to colour exa’s interface when colours are -/// enabled. This includes all the colours that LS_COLORS would recognise, +/// enabled. This includes all the colours that `LS_COLORS` would recognise, /// overriding them if necessary. It can also contain exa-specific codes. pub static EXA_COLORS: &str = "EXA_COLORS"; diff --git a/src/output/cell.rs b/src/output/cell.rs index 25996e0..fb0349b 100644 --- a/src/output/cell.rs +++ b/src/output/cell.rs @@ -165,7 +165,7 @@ impl TextCellContents { /// counting the number of characters in each unformatted ANSI string. pub fn width(&self) -> DisplayWidth { self.0.iter() - .map(|anstr| DisplayWidth::from(anstr.deref())) + .map(|anstr| DisplayWidth::from(&**anstr)) .sum() } diff --git a/src/output/render/size.rs b/src/output/render/size.rs index 498f647..94e4798 100644 --- a/src/output/render/size.rs +++ b/src/output/render/size.rs @@ -38,8 +38,8 @@ impl f::Size { }; let symbol = prefix.symbol(); - let number = if n < 10f64 { numerics.format_float(n, 1) } - else { numerics.format_int(n as isize) }; + let number = if n < 10_f64 { numerics.format_float(n, 1) } + else { numerics.format_int(n as isize) }; // The numbers and symbols are guaranteed to be written in ASCII, so // we can skip the display width calculation.