1
Fork 0

Use Vec extend instead of repeated pushes in several places

This commit is contained in:
Jakub Beránek 2021-12-08 22:56:26 +01:00
parent e6b883c74f
commit 883d0a7aa5
No known key found for this signature in database
GPG key ID: DBC553E540C2F619
5 changed files with 6 additions and 16 deletions

View file

@ -686,9 +686,8 @@ fn bounds_from_generic_predicates<'tcx>(
};
let mut where_clauses = vec![];
for (ty, bounds) in types {
for bound in &bounds {
where_clauses.push(format!("{}: {}", ty, tcx.def_path_str(*bound)));
}
where_clauses
.extend(bounds.into_iter().map(|bound| format!("{}: {}", ty, tcx.def_path_str(bound))));
}
for projection in &projections {
let p = projection.skip_binder();

View file

@ -904,10 +904,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
) -> MigrationWarningReason {
let mut reasons = MigrationWarningReason::default();
for auto_trait in auto_trait_reasons {
reasons.auto_traits.push(auto_trait);
}
reasons.auto_traits.extend(auto_trait_reasons);
reasons.drop_order = drop_order;
reasons