Clippy fixes

pull/686/head
Arijit Basu 5 months ago
parent 7bea7217c6
commit e81d111fd2
No known key found for this signature in database
GPG Key ID: 0F8EF5258DC38077

@ -172,12 +172,10 @@ impl History {
}
fn _is_deepest_dir(&self, path: &str) -> bool {
return self
return !self
.paths
.iter()
.filter(|p| p.ends_with('/') && p.starts_with(path) && &path != p)
.next()
.is_none();
.any(|p| p.ends_with('/') && p.starts_with(path) && path != p);
}
fn _uniq_deep_dirs(&self) -> IndexSet<String> {
@ -194,8 +192,7 @@ impl History {
if let Some(path) = uniq_deep_dirs
.iter()
.skip_while(|p| p.trim_end_matches('/') != pwd)
.skip(1)
.next()
.nth(1)
{
self.push(path.to_string())
} else {
@ -209,8 +206,7 @@ impl History {
.iter()
.rev()
.skip_while(|p| p.trim_end_matches('/') != pwd)
.skip(1)
.next()
.nth(1)
{
self.push(path.to_string())
} else {
@ -318,9 +314,7 @@ impl App {
}
};
let config_files = config_file
.into_iter()
.chain(extra_config_files.into_iter());
let config_files = config_file.into_iter().chain(extra_config_files);
let mut load_errs = vec![];
for config_file in config_files {
@ -2106,7 +2100,7 @@ impl App {
let read_only = self.config.general.read_only;
let global_kb = &self.config.general.global_key_bindings;
let modes = builtin.into_iter().chain(custom.into_iter());
let modes = builtin.into_iter().chain(custom);
std::iter::once((self.mode.name.clone(), self.mode.clone()))
.chain(modes)

@ -39,8 +39,8 @@ where
}
(None, _) => comps.push(Component::ParentDir),
(Some(a), Some(b)) if comps.is_empty() && a == b => (),
(Some(a), Some(b)) if b == Component::CurDir => comps.push(a),
(Some(_), Some(b)) if b == Component::ParentDir => {
(Some(a), Some(Component::CurDir)) => comps.push(a),
(Some(_), Some(Component::ParentDir)) => {
let path = path.to_string_lossy();
let base = base.to_string_lossy();
bail!("{base} is not a parent of {path}")
@ -242,7 +242,7 @@ mod tests {
.unwrap();
assert_eq!(
relative,
PathBuf::from("../..").join(parent.clone().file_name().unwrap())
PathBuf::from("../..").join(parent.file_name().unwrap())
);
}

Loading…
Cancel
Save