Use Option::is_some_and and Result::is_ok_and in the compiler
This commit is contained in:
@@ -86,12 +86,11 @@ impl UnstableFeatures {
|
||||
let disable_unstable_features =
|
||||
option_env!("CFG_DISABLE_UNSTABLE_FEATURES").map(|s| s != "0").unwrap_or(false);
|
||||
// Returns whether `krate` should be counted as unstable
|
||||
let is_unstable_crate = |var: &str| {
|
||||
krate.map_or(false, |name| var.split(',').any(|new_krate| new_krate == name))
|
||||
};
|
||||
let is_unstable_crate =
|
||||
|var: &str| krate.is_some_and(|name| var.split(',').any(|new_krate| new_krate == name));
|
||||
// `true` if we should enable unstable features for bootstrapping.
|
||||
let bootstrap = std::env::var("RUSTC_BOOTSTRAP")
|
||||
.map_or(false, |var| var == "1" || is_unstable_crate(&var));
|
||||
let bootstrap =
|
||||
std::env::var("RUSTC_BOOTSTRAP").is_ok_and(|var| var == "1" || is_unstable_crate(&var));
|
||||
match (disable_unstable_features, bootstrap) {
|
||||
(_, true) => UnstableFeatures::Cheat,
|
||||
(true, _) => UnstableFeatures::Disallow,
|
||||
|
||||
Reference in New Issue
Block a user