diff options
| author | Cameron Steffen <cam.steffen94@gmail.com> | 2021-05-06 20:22:10 -0500 |
|---|---|---|
| committer | Cameron Steffen <cam.steffen94@gmail.com> | 2021-05-26 16:53:13 -0500 |
| commit | 7dd356d9f1c91fb52fb7568ad6439b572a353686 (patch) | |
| tree | e1c32eb891c0cacd7e1e4a8c04a8242886429691 | |
| parent | c51472b4b09d22bdbb46027f08be54c4b285a725 (diff) | |
| download | rust-7dd356d9f1c91fb52fb7568ad6439b572a353686.tar.gz rust-7dd356d9f1c91fb52fb7568ad6439b572a353686.zip | |
Eat dogfood
| -rw-r--r-- | build.rs | 2 | ||||
| -rw-r--r-- | rustc_tools_util/src/lib.rs | 12 |
2 files changed, 7 insertions, 7 deletions
diff --git a/build.rs b/build.rs index 018375dbada..b5484bec3c8 100644 --- a/build.rs +++ b/build.rs @@ -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() ); } diff --git a/rustc_tools_util/src/lib.rs b/rustc_tools_util/src/lib.rs index ff2a7de5725..5f289918a7c 100644 --- a/rustc_tools_util/src/lib.rs +++ b/rustc_tools_util/src/lib.rs @@ -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") @@ -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"), } }, } |
