diff options
-rw-r--r-- | crates/ra_project_model/src/lib.rs | 18 |
1 files changed, 6 insertions, 12 deletions
diff --git a/crates/ra_project_model/src/lib.rs b/crates/ra_project_model/src/lib.rs index 8fa895aa6..c2b33c1dc 100644 --- a/crates/ra_project_model/src/lib.rs +++ b/crates/ra_project_model/src/lib.rs | |||
@@ -558,18 +558,12 @@ pub fn get_rustc_cfg_options(target: Option<&String>) -> CfgOptions { | |||
558 | 558 | ||
559 | match (|| -> Result<String> { | 559 | match (|| -> Result<String> { |
560 | // `cfg(test)` and `cfg(debug_assertion)` are handled outside, so we suppress them here. | 560 | // `cfg(test)` and `cfg(debug_assertion)` are handled outside, so we suppress them here. |
561 | let output = if let Some(target) = target { | 561 | let mut cmd = Command::new("rustc"); |
562 | Command::new("rustc") | 562 | cmd.args(&["--print", "cfg", "-O"]); |
563 | .args(&["--print", "cfg", "-O", "--target", target.as_str()]) | 563 | if let Some(target) = target { |
564 | .output() | 564 | cmd.args(&["--target", target.as_str()]); |
565 | .context("Failed to get output from rustc --print cfg -O")? | 565 | } |
566 | } else { | 566 | let output = cmd.output().context("Failed to get output from rustc --print cfg -O")?; |
567 | Command::new("rustc") | ||
568 | .args(&["--print", "cfg", "-O"]) | ||
569 | .output() | ||
570 | .context("Failed to get output from rustc --print cfg -O")? | ||
571 | }; | ||
572 | |||
573 | if !output.status.success() { | 567 | if !output.status.success() { |
574 | bail!( | 568 | bail!( |
575 | "rustc --print cfg -O exited with exit code ({})", | 569 | "rustc --print cfg -O exited with exit code ({})", |