1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2025-07-27 19:17:43 +00:00

Use map/default instead of match

Signed-off-by: Hanif Bin Ariffin <hanif.ariffin.4326@gmail.com>
This commit is contained in:
Hanif Bin Ariffin 2021-07-10 18:51:24 +08:00
parent 199b4e437b
commit 15f6e35163

View file

@ -259,10 +259,10 @@ pub fn uumain(args: impl uucore::Args) -> i32 {
let squeeze_flag = matches.is_present(options::SQUEEZE);
let truncate_flag = matches.is_present(options::TRUNCATE);
let sets = match matches.values_of(options::SETS) {
Some(v) => v.map(|v| v.to_string()).collect(),
None => vec![],
};
let sets = matches
.values_of(options::SETS)
.map(|v| v.map(ToString::to_string).collect::<Vec<_>>())
.unwrap_or_default();
if sets.is_empty() {
show_error!(