Skip to content

Commit 52a70c3

Browse files
committed
minor: simplify
1 parent 493ed2c commit 52a70c3

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

crates/project_model/src/cargo_workspace.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -229,6 +229,12 @@ impl CargoWorkspace {
229229
config: &CargoConfig,
230230
progress: &dyn Fn(String),
231231
) -> Result<cargo_metadata::Metadata> {
232+
let target = config
233+
.target
234+
.clone()
235+
.or_else(|| cargo_config_build_target(cargo_toml))
236+
.or_else(|| rustc_discover_host_triple(cargo_toml));
237+
232238
let mut meta = MetadataCommand::new();
233239
meta.cargo_path(toolchain::cargo());
234240
meta.manifest_path(cargo_toml.to_path_buf());
@@ -245,13 +251,7 @@ impl CargoWorkspace {
245251
}
246252
}
247253
meta.current_dir(cargo_toml.parent().as_os_str());
248-
let target = if let Some(target) = &config.target {
249-
Some(target.clone())
250-
} else if let stdout @ Some(_) = cargo_config_build_target(cargo_toml) {
251-
stdout
252-
} else {
253-
rustc_discover_host_triple(cargo_toml)
254-
};
254+
255255
if let Some(target) = target {
256256
meta.other_options(vec![String::from("--filter-platform"), target]);
257257
}

0 commit comments

Comments
 (0)