aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_project_model
diff options
context:
space:
mode:
authorChristophe MASSOLIN <[email protected]>2020-05-05 17:23:47 +0100
committerChristophe MASSOLIN <[email protected]>2020-05-05 17:23:47 +0100
commit04e32fbffca22e632594218e8dfafdc39281c6f7 (patch)
treeb076e51f121aafa064e0bf5bd69eed303e91f3eb /crates/ra_project_model
parent14dde99627119f76fd9970dcd07f883be5bc7101 (diff)
Remove code duplicates
Diffstat (limited to 'crates/ra_project_model')
-rw-r--r--crates/ra_project_model/src/lib.rs18
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 ({})",