From dbceaf522b717bd0dda89f6af1684ebd8e033aee Mon Sep 17 00:00:00 2001 From: Paul Daniel Faria Date: Mon, 8 Jun 2020 12:10:23 -0400 Subject: Use Option<&str> for target instead of Option<&String> --- crates/ra_project_model/src/lib.rs | 6 +++--- crates/rust-analyzer/src/global_state.rs | 2 +- 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 { pub fn to_crate_graph( &self, - target: Option<&String>, + target: Option<&str>, extern_source_roots: &FxHashMap, proc_macro_client: &ProcMacroClient, load: &mut dyn FnMut(&Path) -> Option, @@ -560,7 +560,7 @@ impl ProjectWorkspace { } } -fn get_rustc_cfg_options(target: Option<&String>) -> CfgOptions { +fn get_rustc_cfg_options(target: Option<&str>) -> CfgOptions { let mut cfg_options = CfgOptions::default(); // Some nightly-only cfgs, which are required for stdlib @@ -578,7 +578,7 @@ fn get_rustc_cfg_options(target: Option<&String>) -> CfgOptions { let mut cmd = Command::new(ra_toolchain::rustc()); cmd.args(&["--print", "cfg", "-O"]); if let Some(target) = target { - cmd.args(&["--target", target.as_str()]); + cmd.args(&["--target", target]); } let output = output(cmd)?; 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 { }; for ws in workspaces.iter() { crate_graph.extend(ws.to_crate_graph( - config.cargo.target.as_ref(), + config.cargo.target.as_deref(), &extern_source_roots, &proc_macro_client, &mut load, -- cgit v1.2.3