diff --git a/src/bin/coreutils.rs b/src/bin/coreutils.rs index 4647ce962..c7a74974f 100644 --- a/src/bin/coreutils.rs +++ b/src/bin/coreutils.rs @@ -36,7 +36,7 @@ fn usage(utils: &UtilityMap, name: &str) { fn binary_path(args: &mut impl Iterator) -> PathBuf { match args.next() { - Some(s) if !s.is_empty() => PathBuf::from(s), + Some(ref s) if !s.is_empty() => PathBuf::from(s), _ => std::env::current_exe().unwrap(), } } @@ -61,22 +61,21 @@ fn main() { // binary name equals prefixed util name? // * prefix/stem may be any string ending in a non-alphanumeric character - let utilname = - if let Some(util) = utils.keys().find(|util| { - binary_as_util.ends_with(*util) - && !(&binary_as_util[..binary_as_util.len() - (*util).len()]) - .ends_with(char::is_alphanumeric) - }) { - // prefixed util => replace 0th (aka, executable name) argument - Some(OsString::from(*util)) - } else { - // unmatched binary name => regard as multi-binary container and advance argument list - args.next() - }; + let utilname = if let Some(util) = utils.keys().find(|util| { + binary_as_util.ends_with(*util) + && !(&binary_as_util[..binary_as_util.len() - (*util).len()]) + .ends_with(char::is_alphanumeric) + }) { + // prefixed util => replace 0th (aka, executable name) argument + Some(OsString::from(*util)) + } else { + // unmatched binary name => regard as multi-binary container and advance argument list + args.next() + }; // 0th argument equals util name? if let Some(util_os) = utilname { - let util = util_os.as_os_str().to_string_lossy(); + let util = util_os.as_os_str().to_string_lossy(); match utils.get(&util[..]) { Some(&uumain) => { @@ -90,7 +89,10 @@ fn main() { match utils.get(&util[..]) { Some(&uumain) => { - let code = uumain((vec![util_os, OsString::from("--help")].into_iter()).chain(args)); + let code = uumain( + (vec![util_os, OsString::from("--help")].into_iter()) + .chain(args), + ); io::stdout().flush().expect("could not flush stdout"); process::exit(code); } diff --git a/src/uu/base32/src/base32.rs b/src/uu/base32/src/base32.rs index 0bfb12c69..b47f4d4cc 100644 --- a/src/uu/base32/src/base32.rs +++ b/src/uu/base32/src/base32.rs @@ -24,5 +24,11 @@ static LONG_HELP: &str = " "; pub fn uumain(args: impl uucore::Args) -> i32 { - base_common::execute(args.collect_str(), SYNTAX, SUMMARY, LONG_HELP, Format::Base32) + base_common::execute( + args.collect_str(), + SYNTAX, + SUMMARY, + LONG_HELP, + Format::Base32, + ) } diff --git a/src/uu/base64/src/base64.rs b/src/uu/base64/src/base64.rs index da982f391..ee60f3de5 100644 --- a/src/uu/base64/src/base64.rs +++ b/src/uu/base64/src/base64.rs @@ -25,5 +25,11 @@ static LONG_HELP: &str = " "; pub fn uumain(args: impl uucore::Args) -> i32 { - base_common::execute(args.collect_str(), SYNTAX, SUMMARY, LONG_HELP, Format::Base64) + base_common::execute( + args.collect_str(), + SYNTAX, + SUMMARY, + LONG_HELP, + Format::Base64, + ) }