Skip to content

Commit f5e62cb

Browse files
committed
fix: ad-hoc toolchain overwrites settings file
1 parent 404d698 commit f5e62cb

1 file changed

Lines changed: 8 additions & 8 deletions

File tree

src/commands/build.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,10 @@ use tokio::{
1717
};
1818

1919
use crate::{
20-
commands::toolchain::ToolchainCmd, errors::CliError, fs, settings::{Settings, ToolchainCfg, ToolchainType}
20+
commands::toolchain::ToolchainCmd,
21+
errors::CliError,
22+
fs,
23+
settings::{Settings, ToolchainCfg, ToolchainType},
2124
};
2225

2326
/// Common Cargo options to forward.
@@ -90,9 +93,9 @@ pub async fn build(
9093

9194
// If there is a toolchain enabled, we need to put it in scope so that cc builds work correctly.
9295

93-
let toolchain = root_settings
94-
.and_then(|s| s.toolchain.as_ref())
95-
.or(toolchain.as_ref());
96+
let toolchain = toolchain
97+
.as_ref()
98+
.or(root_settings.and_then(|s| s.toolchain.as_ref()));
9699

97100
if let Some(toolchain_cfg) = toolchain {
98101
let ToolchainType::LLVM = toolchain_cfg.ty;
@@ -172,10 +175,7 @@ pub async fn build(
172175
.collect::<Vec<String>>();
173176

174177
let mut rust_flags = link_flags;
175-
rust_flags.push(format!(
176-
"'--cfg=vexide_toolchain=\"{}\"'",
177-
toolchain_cfg.ty
178-
));
178+
rust_flags.push(format!("'--cfg=vexide_toolchain=\"{}\"'", toolchain_cfg.ty));
179179

180180
// N.B. It's okay if the `target.<cfg>.rustflags` key is a duplicate to one in
181181
// the cargo config, they will still merge as expected.

0 commit comments

Comments
 (0)