Rollup merge of #56452 - sinkuu:redundant_clone, r=nikic
Remove redundant clones
This commit is contained in:
commit
4ff4fc1bc9
3 changed files with 4 additions and 4 deletions
|
@ -585,7 +585,7 @@ fn merge_codegen_units<'tcx>(tcx: TyCtxt<'_, 'tcx, 'tcx>,
|
||||||
// smallest into each other) we're sure to start off with a deterministic
|
// smallest into each other) we're sure to start off with a deterministic
|
||||||
// order (sorted by name). This'll mean that if two cgus have the same size
|
// order (sorted by name). This'll mean that if two cgus have the same size
|
||||||
// the stable sort below will keep everything nice and deterministic.
|
// the stable sort below will keep everything nice and deterministic.
|
||||||
codegen_units.sort_by_key(|cgu| cgu.name().clone());
|
codegen_units.sort_by_key(|cgu| *cgu.name());
|
||||||
|
|
||||||
// Merge the two smallest codegen units until the target size is reached.
|
// Merge the two smallest codegen units until the target size is reached.
|
||||||
while codegen_units.len() > target_cgu_count {
|
while codegen_units.len() > target_cgu_count {
|
||||||
|
@ -985,7 +985,7 @@ fn collect_and_partition_mono_items<'a, 'tcx>(
|
||||||
output.push_str(" @@");
|
output.push_str(" @@");
|
||||||
let mut empty = Vec::new();
|
let mut empty = Vec::new();
|
||||||
let cgus = item_to_cgus.get_mut(i).unwrap_or(&mut empty);
|
let cgus = item_to_cgus.get_mut(i).unwrap_or(&mut empty);
|
||||||
cgus.as_mut_slice().sort_by_cached_key(|&(ref name, _)| name.clone());
|
cgus.sort_by_key(|(name, _)| *name);
|
||||||
cgus.dedup();
|
cgus.dedup();
|
||||||
for &(ref cgu_name, (linkage, _)) in cgus.iter() {
|
for &(ref cgu_name, (linkage, _)) in cgus.iter() {
|
||||||
output.push_str(" ");
|
output.push_str(" ");
|
||||||
|
|
|
@ -318,7 +318,7 @@ impl<'a, 'cl> Resolver<'a, 'cl> {
|
||||||
// This particular use tree
|
// This particular use tree
|
||||||
&tree, id, &prefix, true,
|
&tree, id, &prefix, true,
|
||||||
// The whole `use` item
|
// The whole `use` item
|
||||||
parent_scope.clone(), item, ty::Visibility::Invisible, root_span,
|
parent_scope, item, ty::Visibility::Invisible, root_span,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -309,7 +309,7 @@ fn create_matches(len: usize) -> Box<[Rc<NamedMatchVec>]> {
|
||||||
vec![]
|
vec![]
|
||||||
} else {
|
} else {
|
||||||
let empty_matches = Rc::new(SmallVec::new());
|
let empty_matches = Rc::new(SmallVec::new());
|
||||||
vec![empty_matches.clone(); len]
|
vec![empty_matches; len]
|
||||||
}.into_boxed_slice()
|
}.into_boxed_slice()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue