From c9b4ac5be4daaabc062ab1ee663eba8594750003 Mon Sep 17 00:00:00 2001 From: Maan2003 Date: Sun, 13 Jun 2021 09:24:16 +0530 Subject: clippy::redudant_borrow --- crates/project_model/src/build_data.rs | 2 +- crates/project_model/src/cargo_workspace.rs | 2 +- crates/project_model/src/sysroot.rs | 4 ++-- crates/project_model/src/workspace.rs | 12 ++++++------ 4 files changed, 10 insertions(+), 10 deletions(-) (limited to 'crates/project_model') diff --git a/crates/project_model/src/build_data.rs b/crates/project_model/src/build_data.rs index 33a4f8168..53cb4bae7 100644 --- a/crates/project_model/src/build_data.rs +++ b/crates/project_model/src/build_data.rs @@ -184,7 +184,7 @@ impl WorkspaceBuildData { // Copy-pasted from existing cargo_metadata. It seems like we // should be using sered_stacker here? - let mut deserializer = serde_json::Deserializer::from_str(&line); + let mut deserializer = serde_json::Deserializer::from_str(line); deserializer.disable_recursion_limit(); let message = Message::deserialize(&mut deserializer) .unwrap_or(Message::TextLine(line.to_string())); diff --git a/crates/project_model/src/cargo_workspace.rs b/crates/project_model/src/cargo_workspace.rs index b8ad08364..ac079f83e 100644 --- a/crates/project_model/src/cargo_workspace.rs +++ b/crates/project_model/src/cargo_workspace.rs @@ -278,7 +278,7 @@ impl CargoWorkspace { id, edition, name, manifest_path, version, metadata, .. } = meta_pkg; let meta = from_value::(metadata.clone()).unwrap_or_default(); - let is_member = ws_members.contains(&id); + let is_member = ws_members.contains(id); let edition = edition .parse::() .with_context(|| format!("Failed to parse edition {}", edition))?; diff --git a/crates/project_model/src/sysroot.rs b/crates/project_model/src/sysroot.rs index 4e39d6dd3..a22f79c15 100644 --- a/crates/project_model/src/sysroot.rs +++ b/crates/project_model/src/sysroot.rs @@ -142,12 +142,12 @@ fn discover_sysroot_src_dir( log::debug!("RUST_SRC_PATH is set, but is invalid (no core: {:?}), ignoring", core); } - get_rust_src(&sysroot_path) + get_rust_src(sysroot_path) .or_else(|| { let mut rustup = Command::new(toolchain::rustup()); rustup.current_dir(current_dir).args(&["component", "add", "rust-src"]); utf8_stdout(rustup).ok()?; - get_rust_src(&sysroot_path) + get_rust_src(sysroot_path) }) .ok_or_else(|| { format_err!( diff --git a/crates/project_model/src/workspace.rs b/crates/project_model/src/workspace.rs index 84990075f..ef0f3c9e4 100644 --- a/crates/project_model/src/workspace.rs +++ b/crates/project_model/src/workspace.rs @@ -185,7 +185,7 @@ impl ProjectWorkspace { pub fn load_detached_files(detached_files: Vec) -> Result { let sysroot = Sysroot::discover( - &detached_files.first().ok_or_else(|| format_err!("No detached files to load"))?, + detached_files.first().ok_or_else(|| format_err!("No detached files to load"))?, )?; let rustc_cfg = rustc_cfg::get(None, None); Ok(ProjectWorkspace::DetachedFiles { files: detached_files, sysroot, rustc_cfg }) @@ -324,7 +324,7 @@ impl ProjectWorkspace { pub fn collect_build_data_configs(&self, collector: &mut BuildDataCollector) { match self { ProjectWorkspace::Cargo { cargo, .. } => { - collector.add_config(&cargo.workspace_root(), cargo.build_data_config().clone()); + collector.add_config(cargo.workspace_root(), cargo.build_data_config().clone()); } _ => {} } @@ -348,7 +348,7 @@ fn project_json_to_crate_graph( .crates() .filter_map(|(crate_id, krate)| { let file_path = &krate.root_module; - let file_id = load(&file_path)?; + let file_id = load(file_path)?; Some((crate_id, krate, file_id)) }) .map(|(crate_id, krate, file_id)| { @@ -534,7 +534,7 @@ fn detached_files_to_crate_graph( cfg_options.extend(rustc_cfg); for detached_file in detached_files { - let file_id = match load(&detached_file) { + let file_id = match load(detached_file) { Some(file_id) => file_id, None => { log::error!("Failed to load detached file {:?}", detached_file); @@ -602,7 +602,7 @@ fn handle_rustc_crates( crate_graph, &rustc_workspace[pkg], rustc_build_data_map.and_then(|it| it.get(&rustc_workspace[pkg].id)), - &cfg_options, + cfg_options, proc_macro_loader, file_id, &rustc_workspace[tgt].name, @@ -685,7 +685,7 @@ fn add_target_crate_root( let proc_macro = build_data .as_ref() .and_then(|it| it.proc_macro_dylib_path.as_ref()) - .map(|it| proc_macro_loader(&it)) + .map(|it| proc_macro_loader(it)) .unwrap_or_default(); let display_name = CrateDisplayName::from_canonical_name(cargo_name.to_string()); -- cgit v1.2.3