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]) {
|
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 has_z_unstable_option = matches.opt_strs("Z").iter().any(|x| *x == "unstable-options");
|
||||||
let really_allows_unstable_options = match UnstableFeatures::from_environment() {
|
let really_allows_unstable_options = UnstableFeatures::from_environment().is_nightly_build();
|
||||||
UnstableFeatures::Disallow => false,
|
|
||||||
_ => true,
|
|
||||||
};
|
|
||||||
|
|
||||||
for opt in flags.iter() {
|
for opt in flags.iter() {
|
||||||
if opt.stability == OptionStability::Stable {
|
if opt.stability == OptionStability::Stable {
|
||||||
|
|
|
@ -649,10 +649,7 @@ impl RustcDefaultCalls {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
PrintRequest::Cfg => {
|
PrintRequest::Cfg => {
|
||||||
let allow_unstable_cfg = match UnstableFeatures::from_environment() {
|
let allow_unstable_cfg = UnstableFeatures::from_environment().is_nightly_build();
|
||||||
UnstableFeatures::Disallow => false,
|
|
||||||
_ => true,
|
|
||||||
};
|
|
||||||
|
|
||||||
for cfg in cfg {
|
for cfg in cfg {
|
||||||
if !allow_unstable_cfg && GatedCfg::gate(&*cfg).is_some() {
|
if !allow_unstable_cfg && GatedCfg::gate(&*cfg).is_some() {
|
||||||
|
|
|
@ -477,13 +477,10 @@ impl LangString {
|
||||||
let mut data = LangString::all_false();
|
let mut data = LangString::all_false();
|
||||||
let mut allow_compile_fail = false;
|
let mut allow_compile_fail = false;
|
||||||
let mut allow_error_code_check = false;
|
let mut allow_error_code_check = false;
|
||||||
match UnstableFeatures::from_environment() {
|
if UnstableFeatures::from_environment().is_nightly_build() {
|
||||||
UnstableFeatures::Allow | UnstableFeatures::Cheat => {
|
allow_compile_fail = true;
|
||||||
allow_compile_fail = true;
|
allow_error_code_check = true;
|
||||||
allow_error_code_check = true;
|
}
|
||||||
}
|
|
||||||
_ => {},
|
|
||||||
};
|
|
||||||
|
|
||||||
let tokens = string.split(|c: char|
|
let tokens = string.split(|c: char|
|
||||||
!(c == '_' || c == '-' || c.is_alphanumeric())
|
!(c == '_' || c == '-' || c.is_alphanumeric())
|
||||||
|
|
Loading…
Add table
Reference in a new issue