1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2025-07-29 12:07:46 +00:00

Merge pull request #1617 from sylvestre/clippy-fix

Fix some clippy warnings
This commit is contained in:
Roy Ivy III 2020-10-25 10:35:35 -05:00 committed by GitHub
commit 58d7d89e07
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 3 additions and 5 deletions

View file

@ -676,7 +676,7 @@ fn filter_mount_list(vmi: Vec<MountInfo>, paths: &[String], opt: &Options) -> Ve
#[allow(clippy::map_entry)] #[allow(clippy::map_entry)]
{ {
if acc.contains_key(&id) { if acc.contains_key(&id) {
let seen = acc.get(&id).unwrap().replace(mi.clone()); let seen = acc[&id].replace(mi.clone());
let target_nearer_root = seen.mount_dir.len() > mi.mount_dir.len(); let target_nearer_root = seen.mount_dir.len() > mi.mount_dir.len();
// With bind mounts, prefer items nearer the root of the source // With bind mounts, prefer items nearer the root of the source
let source_below_root = !seen.mount_root.is_empty() let source_below_root = !seen.mount_root.is_empty()
@ -694,7 +694,7 @@ fn filter_mount_list(vmi: Vec<MountInfo>, paths: &[String], opt: &Options) -> Ve
environments for example. */ environments for example. */
|| seen.mount_dir != mi.mount_dir) || seen.mount_dir != mi.mount_dir)
{ {
acc.get(&id).unwrap().replace(seen); acc[&id].replace(seen);
} }
} else { } else {
acc.insert(id, Cell::new(mi)); acc.insert(id, Cell::new(mi));

View file

@ -32,7 +32,6 @@ fn tabstops_parse(s: String) -> Vec<usize> {
let words = s.split(','); let words = s.split(',');
let nums = words let nums = words
.into_iter()
.map(|sn| { .map(|sn| {
sn.parse::<usize>() sn.parse::<usize>()
.unwrap_or_else(|_| crash!(1, "{}\n", "tab size contains invalid character(s)")) .unwrap_or_else(|_| crash!(1, "{}\n", "tab size contains invalid character(s)"))

View file

@ -131,7 +131,7 @@ impl Graph {
} }
fn has_edge(&self, from: &str, to: &str) -> bool { fn has_edge(&self, from: &str, to: &str) -> bool {
self.in_edges.get(to).unwrap().contains(from) self.in_edges[to].contains(from)
} }
fn init_node(&mut self, n: &str) { fn init_node(&mut self, n: &str) {

View file

@ -29,7 +29,6 @@ fn tabstops_parse(s: String) -> Vec<usize> {
let words = s.split(','); let words = s.split(',');
let nums = words let nums = words
.into_iter()
.map(|sn| { .map(|sn| {
sn.parse() sn.parse()
.unwrap_or_else(|_| crash!(1, "{}\n", "tab size contains invalid character(s)")) .unwrap_or_else(|_| crash!(1, "{}\n", "tab size contains invalid character(s)"))