deduplicate inline is_nightly_build implementations
This commit is contained in:
parent
3f287efc82
commit
ad81f11b01
3 changed files with 6 additions and 15 deletions
|
@ -1572,10 +1572,7 @@ pub mod nightly_options {
|
|||
|
||||
pub fn check_nightly_options(matches: &getopts::Matches, flags: &[RustcOptGroup]) {
|
||||
let has_z_unstable_option = matches.opt_strs("Z").iter().any(|x| *x == "unstable-options");
|
||||
let really_allows_unstable_options = match UnstableFeatures::from_environment() {
|
||||
UnstableFeatures::Disallow => false,
|
||||
_ => true,
|
||||
};
|
||||
let really_allows_unstable_options = UnstableFeatures::from_environment().is_nightly_build();
|
||||
|
||||
for opt in flags.iter() {
|
||||
if opt.stability == OptionStability::Stable {
|
||||
|
|
|
@ -649,10 +649,7 @@ impl RustcDefaultCalls {
|
|||
}
|
||||
}
|
||||
PrintRequest::Cfg => {
|
||||
let allow_unstable_cfg = match UnstableFeatures::from_environment() {
|
||||
UnstableFeatures::Disallow => false,
|
||||
_ => true,
|
||||
};
|
||||
let allow_unstable_cfg = UnstableFeatures::from_environment().is_nightly_build();
|
||||
|
||||
for cfg in cfg {
|
||||
if !allow_unstable_cfg && GatedCfg::gate(&*cfg).is_some() {
|
||||
|
|
|
@ -477,13 +477,10 @@ impl LangString {
|
|||
let mut data = LangString::all_false();
|
||||
let mut allow_compile_fail = false;
|
||||
let mut allow_error_code_check = false;
|
||||
match UnstableFeatures::from_environment() {
|
||||
UnstableFeatures::Allow | UnstableFeatures::Cheat => {
|
||||
allow_compile_fail = true;
|
||||
allow_error_code_check = true;
|
||||
}
|
||||
_ => {},
|
||||
};
|
||||
if UnstableFeatures::from_environment().is_nightly_build() {
|
||||
allow_compile_fail = true;
|
||||
allow_error_code_check = true;
|
||||
}
|
||||
|
||||
let tokens = string.split(|c: char|
|
||||
!(c == '_' || c == '-' || c.is_alphanumeric())
|
||||
|
|
Loading…
Add table
Reference in a new issue