From e83704ac9a6e5297fce20f141784ecb076bfc24e Mon Sep 17 00:00:00 2001 From: hi-rustin Date: Sun, 14 Nov 2021 22:48:37 +0800 Subject: [PATCH] Remove needless borrow to make clippy happy Signed-off-by: hi-rustin --- src/cargo/core/compiler/mod.rs | 2 +- src/cargo/core/compiler/unit_dependencies.rs | 6 +++--- src/cargo/util/toml/mod.rs | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/cargo/core/compiler/mod.rs b/src/cargo/core/compiler/mod.rs index 2781ffbd8cf..884f1efc367 100644 --- a/src/cargo/core/compiler/mod.rs +++ b/src/cargo/core/compiler/mod.rs @@ -648,7 +648,7 @@ fn rustdoc(cx: &mut Context<'_, '_>, unit: &Unit) -> CargoResult { rustdoc.args(args); } - let metadata = cx.metadata_for_doc_units[&unit]; + let metadata = cx.metadata_for_doc_units[unit]; rustdoc.arg("-C").arg(format!("metadata={}", metadata)); let scrape_output_path = |unit: &Unit| -> CargoResult { diff --git a/src/cargo/core/compiler/unit_dependencies.rs b/src/cargo/core/compiler/unit_dependencies.rs index ae8ca69aa46..d89d416b1a6 100644 --- a/src/cargo/core/compiler/unit_dependencies.rs +++ b/src/cargo/core/compiler/unit_dependencies.rs @@ -132,7 +132,7 @@ fn calc_deps_of_std( // Compute dependencies for the standard library. state.is_std = true; for roots in std_roots.values() { - deps_of_roots(roots, &mut state)?; + deps_of_roots(roots, state)?; } state.is_std = false; Ok(Some(std::mem::take(&mut state.unit_dependencies))) @@ -172,7 +172,7 @@ fn attach_std_deps( /// Compute all the dependencies of the given root units. /// The result is stored in state.unit_dependencies. -fn deps_of_roots(roots: &[Unit], mut state: &mut State<'_, '_>) -> CargoResult<()> { +fn deps_of_roots(roots: &[Unit], state: &mut State<'_, '_>) -> CargoResult<()> { for unit in roots.iter() { // Dependencies of tests/benches should not have `panic` set. // We check the global test mode to see if we are running in `cargo @@ -200,7 +200,7 @@ fn deps_of_roots(roots: &[Unit], mut state: &mut State<'_, '_>) -> CargoResult<( } else { UnitFor::new_normal() }; - deps_of(unit, &mut state, unit_for)?; + deps_of(unit, state, unit_for)?; } Ok(()) diff --git a/src/cargo/util/toml/mod.rs b/src/cargo/util/toml/mod.rs index aa26d0897e8..e34b0809330 100644 --- a/src/cargo/util/toml/mod.rs +++ b/src/cargo/util/toml/mod.rs @@ -1248,7 +1248,7 @@ impl TomlManifest { for (name, platform) in me.target.iter().flatten() { cx.platform = { let platform: Platform = name.parse()?; - platform.check_cfg_attributes(&mut cx.warnings); + platform.check_cfg_attributes(cx.warnings); Some(platform) }; process_dependencies(&mut cx, platform.dependencies.as_ref(), None)?;