utilbox/umount - use Vec::retain instead of iter/filter/collect
This commit is contained in:
parent
39c3803acb
commit
a468b09816
@ -69,23 +69,16 @@ impl Cmd for Umount {
|
||||
&& x.fstype != "devpts"
|
||||
&& x.fstype != "rpc_pipefs"
|
||||
&& x.fstype != "nfsd"
|
||||
&& x.fstype != "swap"
|
||||
})
|
||||
.collect();
|
||||
if let Some(types) = matches.get_many::<String>("types") {
|
||||
for t in types {
|
||||
if t.starts_with("no") {
|
||||
let t = t.strip_prefix("no").unwrap();
|
||||
mntpts = mntpts
|
||||
.iter()
|
||||
.filter(|x| x.fstype != t)
|
||||
.map(|x| x.clone())
|
||||
.collect();
|
||||
mntpts.retain(|x| x.fstype != t);
|
||||
} else {
|
||||
mntpts = mntpts
|
||||
.iter()
|
||||
.filter(|x| &x.fstype == t)
|
||||
.map(|x| x.clone())
|
||||
.collect();
|
||||
mntpts.retain(|x| &x.fstype == t);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user