1
Fork 0

Replace some thens with some then_somes

This commit is contained in:
Maybe Waffle 2023-02-15 17:39:43 +00:00
parent 8751fa1a9a
commit 5bf6a46032
24 changed files with 27 additions and 26 deletions

View file

@ -2544,7 +2544,7 @@ pub fn build_session_options(matches: &getopts::Matches) -> Options {
}
// Only use this directory if it has a file we can expect to always find.
candidate.join("library/std/src/lib.rs").is_file().then(|| candidate)
candidate.join("library/std/src/lib.rs").is_file().then_some(candidate)
};
let working_dir = std::env::current_dir().unwrap_or_else(|e| {

View file

@ -217,7 +217,7 @@ pub fn get_or_default_sysroot() -> Result<PathBuf, String> {
// Look for the target rustlib directory in the suspected sysroot.
let mut rustlib_path = rustc_target::target_rustlib_path(&p, "dummy");
rustlib_path.pop(); // pop off the dummy target.
rustlib_path.exists().then(|| p)
rustlib_path.exists().then_some(p)
}
None => None,
}

View file

@ -809,7 +809,7 @@ mod parse {
if v.is_some() {
let mut bool_arg = None;
if parse_opt_bool(&mut bool_arg, v) {
*slot = bool_arg.unwrap().then(|| MirSpanview::Statement);
*slot = bool_arg.unwrap().then_some(MirSpanview::Statement);
return true;
}
}
@ -850,7 +850,7 @@ mod parse {
if v.is_some() {
let mut bool_arg = None;
if parse_opt_bool(&mut bool_arg, v) {
*slot = bool_arg.unwrap().then(|| InstrumentCoverage::All);
*slot = bool_arg.unwrap().then_some(InstrumentCoverage::All);
return true;
}
}