Skip to content

Commit

Permalink
Eat dogfood
Browse files Browse the repository at this point in the history
  • Loading branch information
camsteffen committed May 26, 2021
1 parent c51472b commit 7dd356d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@ fn main() {
);
println!(
"cargo:rustc-env=RUSTC_RELEASE_CHANNEL={}",
rustc_tools_util::get_channel().unwrap_or_default()
rustc_tools_util::get_channel()
);
}
12 changes: 6 additions & 6 deletions rustc_tools_util/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -100,9 +100,9 @@ pub fn get_commit_date() -> Option<String> {
}

#[must_use]
pub fn get_channel() -> Option<String> {
pub fn get_channel() -> String {
match env::var("CFG_RELEASE_CHANNEL") {
Ok(channel) => Some(channel),
Ok(channel) => channel,
Err(_) => {
// if that failed, try to ask rustc -V, do some parsing and find out
match std::process::Command::new("rustc")
Expand All @@ -113,16 +113,16 @@ pub fn get_channel() -> Option<String> {
{
Some(rustc_output) => {
if rustc_output.contains("beta") {
Some(String::from("beta"))
String::from("beta")
} else if rustc_output.contains("stable") {
Some(String::from("stable"))
String::from("stable")
} else {
// default to nightly if we fail to parse
Some(String::from("nightly"))
String::from("nightly")
}
},
// default to nightly
None => Some(String::from("nightly")),
None => String::from("nightly"),
}
},
}
Expand Down

0 comments on commit 7dd356d

Please sign in to comment.