Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions src/bin/uudoc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,12 +78,12 @@ fn gen_manpage<T: Args>(
)
.get_matches_from(std::iter::once(OsString::from("manpage")).chain(args));

let utility = matches.get_one::<String>("utility").unwrap();
let utility = matches.get_one::<String>("utility").expect("utility argument should be present");
let command = if utility == "coreutils" {
gen_coreutils_app(util_map)
} else {
validation::setup_localization_or_exit(utility);
let mut cmd = util_map.get(utility).unwrap().1();
let mut cmd = util_map.get(utility).expect("utility should exist in utility map").1();
cmd.set_bin_name(utility.clone());
let mut cmd = cmd.display_name(utility);
if let Some(zip) = tldr {
Expand All @@ -97,7 +97,7 @@ fn gen_manpage<T: Args>(
let man = Man::new(command);
man.render(&mut io::stdout())
.expect("Man page generation failed");
io::stdout().flush().unwrap();
io::stdout().flush().expect("stdout flush should succeed");
process::exit(0);
}

Expand All @@ -119,19 +119,19 @@ fn gen_completions<T: Args>(args: impl Iterator<Item = OsString>, util_map: &Uti
)
.get_matches_from(std::iter::once(OsString::from("completion")).chain(args));

let utility = matches.get_one::<String>("utility").unwrap();
let shell = *matches.get_one::<Shell>("shell").unwrap();
let utility = matches.get_one::<String>("utility").expect("utility argument should be present");
let shell = *matches.get_one::<Shell>("shell").expect("shell argument should be present");

let mut command = if utility == "coreutils" {
gen_coreutils_app(util_map)
} else {
validation::setup_localization_or_exit(utility);
util_map.get(utility).unwrap().1()
util_map.get(utility).expect("utility should exist in utility map").1()
};
let bin_name = std::env::var("PROG_PREFIX").unwrap_or_default() + utility;

clap_complete::generate(shell, &mut command, bin_name, &mut io::stdout());
io::stdout().flush().unwrap();
io::stdout().flush().expect("stdout flush should succeed");
process::exit(0);
}

Expand Down
2 changes: 1 addition & 1 deletion src/common/validation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ fn get_canonical_util_name(util_name: &str) -> &str {
pub fn binary_path(args: &mut impl Iterator<Item = OsString>) -> PathBuf {
match args.next() {
Some(ref s) if !s.is_empty() => PathBuf::from(s),
_ => std::env::current_exe().unwrap(),
_ => std::env::current_exe().expect("current executable path should be accessible"),
}
}

Expand Down
4 changes: 2 additions & 2 deletions src/uucore/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -502,7 +502,7 @@ mod tests {
collected.push(locale.to_string());
Ok(())
})
.unwrap();
.expect("locale processing should succeed");

assert_eq!(collected, vec!["en-US", "fr-FR"]);
}
Expand All @@ -516,7 +516,7 @@ mod tests {
collected.push(locale.to_string());
Ok(())
})
.unwrap();
.expect("locale processing should succeed");

assert_eq!(collected, vec!["en-US"]);
}
Expand Down
Loading