Skip to content

Commit

Permalink
vargo: Ignore empty VARGO_TOOLCHAIN
Browse files Browse the repository at this point in the history
  • Loading branch information
zhaofengli committed Nov 2, 2023
1 parent 9924b5d commit 22394c9
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions tools/vargo/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,19 +76,20 @@ impl Toolchain {
fn from_environment() -> Option<Self> {
std::env::var("VARGO_TOOLCHAIN")
.ok()
.map(|toolchain| {
.and_then(|toolchain| {
match toolchain.as_str() {
"host" => Self::Host,
"" => None,
"host" => Some(Self::Host),
_ => {
// More relaxed than `rustup show active-toolchain`
let channel = toolchain.split('-').next()
.unwrap_or(&toolchain)
.to_string();

Self::Rustup {
Some(Self::Rustup {
toolchain,
channel,
}
})
}
}
})
Expand Down

0 comments on commit 22394c9

Please sign in to comment.