mirror of
https://github.com/rust-lang/rust-analyzer
synced 2024-12-27 05:23:24 +00:00
Remove code duplicates
This commit is contained in:
parent
14dde99627
commit
04e32fbffc
1 changed files with 6 additions and 12 deletions
|
@ -558,18 +558,12 @@ pub fn get_rustc_cfg_options(target: Option<&String>) -> CfgOptions {
|
||||||
|
|
||||||
match (|| -> Result<String> {
|
match (|| -> Result<String> {
|
||||||
// `cfg(test)` and `cfg(debug_assertion)` are handled outside, so we suppress them here.
|
// `cfg(test)` and `cfg(debug_assertion)` are handled outside, so we suppress them here.
|
||||||
let output = if let Some(target) = target {
|
let mut cmd = Command::new("rustc");
|
||||||
Command::new("rustc")
|
cmd.args(&["--print", "cfg", "-O"]);
|
||||||
.args(&["--print", "cfg", "-O", "--target", target.as_str()])
|
if let Some(target) = target {
|
||||||
.output()
|
cmd.args(&["--target", target.as_str()]);
|
||||||
.context("Failed to get output from rustc --print cfg -O")?
|
}
|
||||||
} else {
|
let output = cmd.output().context("Failed to get output from rustc --print cfg -O")?;
|
||||||
Command::new("rustc")
|
|
||||||
.args(&["--print", "cfg", "-O"])
|
|
||||||
.output()
|
|
||||||
.context("Failed to get output from rustc --print cfg -O")?
|
|
||||||
};
|
|
||||||
|
|
||||||
if !output.status.success() {
|
if !output.status.success() {
|
||||||
bail!(
|
bail!(
|
||||||
"rustc --print cfg -O exited with exit code ({})",
|
"rustc --print cfg -O exited with exit code ({})",
|
||||||
|
|
Loading…
Reference in a new issue