mirror of
https://github.com/uutils/coreutils.git
synced 2026-06-10 15:48:22 -07:00
head: use map_err instead of match in uumain
This commit is contained in:
@@ -554,15 +554,10 @@ fn uu_head(options: &HeadOptions) -> UResult<()> {
|
||||
|
||||
#[uucore::main]
|
||||
pub fn uumain(args: impl uucore::Args) -> UResult<()> {
|
||||
let args_vec: Vec<_> = arg_iterate(args)?.collect();
|
||||
let matches = uu_app().get_matches_from_localized(args_vec);
|
||||
let args = match HeadOptions::get_from(&matches) {
|
||||
Ok(o) => o,
|
||||
Err(s) => {
|
||||
return Err(HeadError::MatchOption(s).into());
|
||||
}
|
||||
};
|
||||
uu_head(&args)
|
||||
let args: Vec<_> = arg_iterate(args)?.collect();
|
||||
let matches = uu_app().get_matches_from_localized(args);
|
||||
let options = HeadOptions::get_from(&matches).map_err(HeadError::MatchOption)?;
|
||||
uu_head(&options)
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
|
||||
Reference in New Issue
Block a user