substitute idiomatic call flag check

This commit is contained in:
xiuxiu62 2021-10-07 14:36:47 -07:00
parent e8e1ead99d
commit 8550f50522

View File

@ -60,7 +60,7 @@ impl Command for Cp {
} }
let any_source_is_dir = sources.iter().any(|f| matches!(f, Ok(f) if f.is_dir())); let any_source_is_dir = sources.iter().any(|f| matches!(f, Ok(f) if f.is_dir()));
let recursive = call.named.iter().any(|p| &p.0 == "recursive"); let recursive: bool = call.has_flag("recursive");
if any_source_is_dir && !recursive { if any_source_is_dir && !recursive {
return Err(ShellError::MoveNotPossibleSingle( return Err(ShellError::MoveNotPossibleSingle(
"Directories must be copied using \"--recursive\"".to_string(), "Directories must be copied using \"--recursive\"".to_string(),