mirror of
https://github.com/Llewellynvdm/exa.git
synced 2024-11-22 03:55:11 +00:00
Various misc clippy fixes
This commit is contained in:
parent
a25cfe765d
commit
c3c39fee0a
@ -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 <https://stackoverflow.com/q/45985827/3484614>
|
||||
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() })
|
||||
},
|
||||
|
@ -66,7 +66,7 @@ pub fn list_attrs(lister: &lister::Lister, path: &Path) -> io::Result<Vec<Attrib
|
||||
Ordering::Greater => {},
|
||||
}
|
||||
|
||||
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) {
|
||||
|
@ -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
|
||||
/// - <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,
|
||||
|
@ -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<glob::Pattern> 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<Item = &'a str>>(iter: I) -> (Self, Vec<glob::PatternError>) {
|
||||
let iter = iter.into_iter();
|
||||
|
||||
|
@ -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(_))
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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
|
||||
|
@ -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<V: Vars>(vars: &V, colours: &mut Colours) -> (ExtensionMappings, bool) {
|
||||
use log::*;
|
||||
|
@ -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";
|
||||
|
||||
|
@ -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()
|
||||
}
|
||||
|
||||
|
@ -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.
|
||||
|
Loading…
Reference in New Issue
Block a user