Skip to content

Commit dbceaf5

Browse files
committed
Use Option<&str> for target instead of Option<&String>
1 parent 9c35f13 commit dbceaf5

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

crates/ra_project_model/src/lib.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,7 @@ impl ProjectWorkspace {
250250

251251
pub fn to_crate_graph(
252252
&self,
253-
target: Option<&String>,
253+
target: Option<&str>,
254254
extern_source_roots: &FxHashMap<PathBuf, ExternSourceId>,
255255
proc_macro_client: &ProcMacroClient,
256256
load: &mut dyn FnMut(&Path) -> Option<FileId>,
@@ -560,7 +560,7 @@ impl ProjectWorkspace {
560560
}
561561
}
562562

563-
fn get_rustc_cfg_options(target: Option<&String>) -> CfgOptions {
563+
fn get_rustc_cfg_options(target: Option<&str>) -> CfgOptions {
564564
let mut cfg_options = CfgOptions::default();
565565

566566
// Some nightly-only cfgs, which are required for stdlib
@@ -578,7 +578,7 @@ fn get_rustc_cfg_options(target: Option<&String>) -> CfgOptions {
578578
let mut cmd = Command::new(ra_toolchain::rustc());
579579
cmd.args(&["--print", "cfg", "-O"]);
580580
if let Some(target) = target {
581-
cmd.args(&["--target", target.as_str()]);
581+
cmd.args(&["--target", target]);
582582
}
583583
let output = output(cmd)?;
584584
Ok(String::from_utf8(output.stdout)?)

crates/rust-analyzer/src/global_state.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ impl GlobalState {
160160
};
161161
for ws in workspaces.iter() {
162162
crate_graph.extend(ws.to_crate_graph(
163-
config.cargo.target.as_ref(),
163+
config.cargo.target.as_deref(),
164164
&extern_source_roots,
165165
&proc_macro_client,
166166
&mut load,

0 commit comments

Comments
 (0)