aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Daniel Faria <[email protected]>2020-06-08 17:10:23 +0100
committerPaul Daniel Faria <[email protected]>2020-06-08 17:10:23 +0100
commitdbceaf522b717bd0dda89f6af1684ebd8e033aee (patch)
tree4a705fb7cc150dd5ad6f13431ac1719455ba6cbf
parent9c35f135b9c872e904ee1e838cfa69fc5745c45f (diff)
Use Option<&str> for target instead of Option<&String>
-rw-r--r--crates/ra_project_model/src/lib.rs6
-rw-r--r--crates/rust-analyzer/src/global_state.rs2
2 files changed, 4 insertions, 4 deletions
diff --git a/crates/ra_project_model/src/lib.rs b/crates/ra_project_model/src/lib.rs
index 4ef2e6f85..fe03b509e 100644
--- a/crates/ra_project_model/src/lib.rs
+++ b/crates/ra_project_model/src/lib.rs
@@ -250,7 +250,7 @@ impl ProjectWorkspace {
250 250
251 pub fn to_crate_graph( 251 pub fn to_crate_graph(
252 &self, 252 &self,
253 target: Option<&String>, 253 target: Option<&str>,
254 extern_source_roots: &FxHashMap<PathBuf, ExternSourceId>, 254 extern_source_roots: &FxHashMap<PathBuf, ExternSourceId>,
255 proc_macro_client: &ProcMacroClient, 255 proc_macro_client: &ProcMacroClient,
256 load: &mut dyn FnMut(&Path) -> Option<FileId>, 256 load: &mut dyn FnMut(&Path) -> Option<FileId>,
@@ -560,7 +560,7 @@ impl ProjectWorkspace {
560 } 560 }
561} 561}
562 562
563fn get_rustc_cfg_options(target: Option<&String>) -> CfgOptions { 563fn get_rustc_cfg_options(target: Option<&str>) -> CfgOptions {
564 let mut cfg_options = CfgOptions::default(); 564 let mut cfg_options = CfgOptions::default();
565 565
566 // Some nightly-only cfgs, which are required for stdlib 566 // Some nightly-only cfgs, which are required for stdlib
@@ -578,7 +578,7 @@ fn get_rustc_cfg_options(target: Option<&String>) -> CfgOptions {
578 let mut cmd = Command::new(ra_toolchain::rustc()); 578 let mut cmd = Command::new(ra_toolchain::rustc());
579 cmd.args(&["--print", "cfg", "-O"]); 579 cmd.args(&["--print", "cfg", "-O"]);
580 if let Some(target) = target { 580 if let Some(target) = target {
581 cmd.args(&["--target", target.as_str()]); 581 cmd.args(&["--target", target]);
582 } 582 }
583 let output = output(cmd)?; 583 let output = output(cmd)?;
584 Ok(String::from_utf8(output.stdout)?) 584 Ok(String::from_utf8(output.stdout)?)
diff --git a/crates/rust-analyzer/src/global_state.rs b/crates/rust-analyzer/src/global_state.rs
index 0b52030cf..73b0f881d 100644
--- a/crates/rust-analyzer/src/global_state.rs
+++ b/crates/rust-analyzer/src/global_state.rs
@@ -160,7 +160,7 @@ impl GlobalState {
160 }; 160 };
161 for ws in workspaces.iter() { 161 for ws in workspaces.iter() {
162 crate_graph.extend(ws.to_crate_graph( 162 crate_graph.extend(ws.to_crate_graph(
163 config.cargo.target.as_ref(), 163 config.cargo.target.as_deref(),
164 &extern_source_roots, 164 &extern_source_roots,
165 &proc_macro_client, 165 &proc_macro_client,
166 &mut load, 166 &mut load,