Eat dogfood
This commit is contained in:
2
build.rs
2
build.rs
@@ -14,6 +14,6 @@ fn main() {
|
|||||||
);
|
);
|
||||||
println!(
|
println!(
|
||||||
"cargo:rustc-env=RUSTC_RELEASE_CHANNEL={}",
|
"cargo:rustc-env=RUSTC_RELEASE_CHANNEL={}",
|
||||||
rustc_tools_util::get_channel().unwrap_or_default()
|
rustc_tools_util::get_channel()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -100,9 +100,9 @@ pub fn get_commit_date() -> Option<String> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[must_use]
|
#[must_use]
|
||||||
pub fn get_channel() -> Option<String> {
|
pub fn get_channel() -> String {
|
||||||
match env::var("CFG_RELEASE_CHANNEL") {
|
match env::var("CFG_RELEASE_CHANNEL") {
|
||||||
Ok(channel) => Some(channel),
|
Ok(channel) => channel,
|
||||||
Err(_) => {
|
Err(_) => {
|
||||||
// if that failed, try to ask rustc -V, do some parsing and find out
|
// if that failed, try to ask rustc -V, do some parsing and find out
|
||||||
match std::process::Command::new("rustc")
|
match std::process::Command::new("rustc")
|
||||||
@@ -113,16 +113,16 @@ pub fn get_channel() -> Option<String> {
|
|||||||
{
|
{
|
||||||
Some(rustc_output) => {
|
Some(rustc_output) => {
|
||||||
if rustc_output.contains("beta") {
|
if rustc_output.contains("beta") {
|
||||||
Some(String::from("beta"))
|
String::from("beta")
|
||||||
} else if rustc_output.contains("stable") {
|
} else if rustc_output.contains("stable") {
|
||||||
Some(String::from("stable"))
|
String::from("stable")
|
||||||
} else {
|
} else {
|
||||||
// default to nightly if we fail to parse
|
// default to nightly if we fail to parse
|
||||||
Some(String::from("nightly"))
|
String::from("nightly")
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
// default to nightly
|
// default to nightly
|
||||||
None => Some(String::from("nightly")),
|
None => String::from("nightly"),
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user