1
Fork 0

Auto merge of #100497 - kadiwa4:remove_clone_into_iter, r=cjgillot

Avoid cloning a collection only to iterate over it

`@rustbot` label: +C-cleanup
This commit is contained in:
bors 2022-08-28 18:31:08 +00:00
commit ce36e88256
12 changed files with 31 additions and 31 deletions

View file

@ -298,9 +298,8 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
// show that order to the user as a possible order for the parameters
let mut param_types_present = defs
.params
.clone()
.into_iter()
.map(|param| (param.kind.to_ord(), param))
.iter()
.map(|param| (param.kind.to_ord(), param.clone()))
.collect::<Vec<(ParamKindOrd, GenericParamDef)>>();
param_types_present.sort_by_key(|(ord, _)| *ord);
let (mut param_types_present, ordered_params): (

View file

@ -1217,7 +1217,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
// Combine all the reasons of why the root variable should be captured as a result of
// auto trait implementation issues
auto_trait_migration_reasons.extend(capture_trait_reasons.clone());
auto_trait_migration_reasons.extend(capture_trait_reasons.iter().copied());
diagnostics_info.push(MigrationLintNote {
captures_info,