Skip to content

Commit 0ed0148

Browse files
committed
remove ref where needless_borrowed_reference
1 parent 84456a0 commit 0ed0148

File tree

9 files changed

+20
-22
lines changed

9 files changed

+20
-22
lines changed

src/cargo/core/compiler/custom_build.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -443,7 +443,7 @@ fn build_work(cx: &mut Context<'_, '_>, unit: &Unit) -> CargoResult<Job> {
443443
))
444444
})?;
445445
let data = &script_output.metadata;
446-
for &(ref key, ref value) in data.iter() {
446+
for (key, value) in data.iter() {
447447
cmd.env(
448448
&format!("DEP_{}_{}", super::envify(&name), super::envify(key)),
449449
value,

src/cargo/core/compiler/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1318,7 +1318,7 @@ fn add_custom_flags(
13181318
cmd.arg("--check-cfg").arg(check_cfg);
13191319
}
13201320
}
1321-
for &(ref name, ref value) in output.env.iter() {
1321+
for (name, value) in output.env.iter() {
13221322
cmd.env(name, value);
13231323
}
13241324
}

src/cargo/core/resolver/dep_cache.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -128,9 +128,9 @@ impl<'a> RegistryQueryer<'a> {
128128
let mut potential_matches = self
129129
.replacements
130130
.iter()
131-
.filter(|&&(ref spec, _)| spec.matches(summary.package_id()));
131+
.filter(|(spec, _)| spec.matches(summary.package_id()));
132132

133-
let &(ref spec, ref dep) = match potential_matches.next() {
133+
let (spec, dep) = match potential_matches.next() {
134134
None => continue,
135135
Some(replacement) => replacement,
136136
};
@@ -188,7 +188,7 @@ impl<'a> RegistryQueryer<'a> {
188188
let matched_spec = spec.clone();
189189

190190
// Make sure no duplicates
191-
if let Some(&(ref spec, _)) = potential_matches.next() {
191+
if let Some((spec, _)) = potential_matches.next() {
192192
return Poll::Ready(Err(anyhow::anyhow!(
193193
"overlapping replacement specifications found:\n\n \
194194
* {}\n * {}\n\nboth specifications match: {}",
@@ -278,7 +278,7 @@ impl<'a> RegistryQueryer<'a> {
278278
// dependencies with more candidates. This way if the dependency with
279279
// only one candidate can't be resolved we don't have to do a bunch of
280280
// work before we figure that out.
281-
deps.sort_by_key(|&(_, ref a, _)| a.len());
281+
deps.sort_by_key(|(_, a, _)| a.len());
282282

283283
let out = Rc::new((used_features, Rc::new(deps)));
284284

src/cargo/core/resolver/encode.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -299,7 +299,7 @@ impl EncodableResolve {
299299

300300
let mut g = Graph::new();
301301

302-
for &(ref id, _) in live_pkgs.values() {
302+
for (id, _) in live_pkgs.values() {
303303
g.add(*id);
304304
}
305305

@@ -435,7 +435,7 @@ fn build_path_deps(ws: &Workspace<'_>) -> CargoResult<HashMap<String, SourceId>>
435435
build_dep(dep, ws, &mut ret, &mut visited);
436436
}
437437
}
438-
for &(_, ref dep) in ws.root_replace() {
438+
for (_, dep) in ws.root_replace() {
439439
build_dep(dep, ws, &mut ret, &mut visited);
440440
}
441441

src/cargo/core/resolver/mod.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ fn activate_deps_loop(
234234
let mut past_conflicting_activations = conflict_cache::ConflictCache::new();
235235

236236
// Activate all the initial summaries to kick off some work.
237-
for &(ref summary, ref opts) in summaries {
237+
for (summary, opts) in summaries {
238238
debug!("initial activation: {}", summary.package_id());
239239
let res = activate(
240240
&mut cx,
@@ -514,9 +514,7 @@ fn activate_deps_loop(
514514
if let Some((other_parent, conflict)) = remaining_deps
515515
.iter()
516516
// for deps related to us
517-
.filter(|&(_, ref other_dep)| {
518-
known_related_bad_deps.contains(other_dep)
519-
})
517+
.filter(|(_, other_dep)| known_related_bad_deps.contains(other_dep))
520518
.filter_map(|(other_parent, other_dep)| {
521519
past_conflicting_activations
522520
.find_conflicting(&cx, &other_dep, Some(pid))

src/cargo/core/workspace.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -510,7 +510,7 @@ impl<'cfg> Workspace<'cfg> {
510510
self.members
511511
.iter()
512512
.filter_map(move |path| match packages.get(path) {
513-
&MaybePackage::Package(ref p) => Some(p),
513+
MaybePackage::Package(p) => Some(p),
514514
_ => None,
515515
})
516516
}
@@ -541,7 +541,7 @@ impl<'cfg> Workspace<'cfg> {
541541
self.default_members
542542
.iter()
543543
.filter_map(move |path| match packages.get(path) {
544-
&MaybePackage::Package(ref p) => Some(p),
544+
MaybePackage::Package(p) => Some(p),
545545
_ => None,
546546
})
547547
}
@@ -1046,7 +1046,7 @@ impl<'cfg> Workspace<'cfg> {
10461046

10471047
pub fn load(&self, manifest_path: &Path) -> CargoResult<Package> {
10481048
match self.packages.maybe_get(manifest_path) {
1049-
Some(&MaybePackage::Package(ref p)) => return Ok(p.clone()),
1049+
Some(MaybePackage::Package(p)) => return Ok(p.clone()),
10501050
Some(&MaybePackage::Virtual(_)) => bail!("cannot load workspace root"),
10511051
None => {}
10521052
}

src/cargo/ops/cargo_compile/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -318,8 +318,8 @@ pub fn create_bcx<'a, 'cfg>(
318318
}
319319

320320
let (extra_args, extra_args_name) = match (target_rustc_args, target_rustdoc_args) {
321-
(&Some(ref args), _) => (Some(args.clone()), "rustc"),
322-
(_, &Some(ref args)) => (Some(args.clone()), "rustdoc"),
321+
(Some(args), _) => (Some(args.clone()), "rustc"),
322+
(_, Some(args)) => (Some(args.clone()), "rustdoc"),
323323
_ => (None, ""),
324324
};
325325

src/cargo/ops/resolve.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ pub fn resolve_ws_with_opts<'cfg>(
153153

154154
add_overrides(&mut registry, ws)?;
155155

156-
for &(ref replace_spec, ref dep) in ws.root_replace() {
156+
for (replace_spec, dep) in ws.root_replace() {
157157
if !resolve
158158
.iter()
159159
.any(|r| replace_spec.matches(r) && !dep.matches_id(r))
@@ -486,7 +486,7 @@ pub fn resolve_with_previous<'cfg>(
486486
let replace = match previous {
487487
Some(r) => root_replace
488488
.iter()
489-
.map(|&(ref spec, ref dep)| {
489+
.map(|(spec, dep)| {
490490
for (&key, &val) in r.replacements().iter() {
491491
if spec.matches(key) && dep.matches_id(val) && keep(&val) {
492492
let mut dep = dep.clone();

src/cargo/util/toml/targets.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -744,7 +744,7 @@ https://github.com/rust-lang/cargo/issues/5330",
744744
fn inferred_to_toml_targets(inferred: &[(String, PathBuf)]) -> Vec<TomlTarget> {
745745
inferred
746746
.iter()
747-
.map(|&(ref name, ref path)| TomlTarget {
747+
.map(|(name, path)| TomlTarget {
748748
name: Some(name.clone()),
749749
path: Some(PathValue(path.clone())),
750750
..TomlTarget::new()
@@ -926,8 +926,8 @@ fn target_path(
926926

927927
let mut matching = inferred
928928
.iter()
929-
.filter(|&&(ref n, _)| n == &name)
930-
.map(|&(_, ref p)| p.clone());
929+
.filter(|(n, _)| n == &name)
930+
.map(|(_, p)| p.clone());
931931

932932
let first = matching.next();
933933
let second = matching.next();

0 commit comments

Comments
 (0)