Skip to content

Commit 93c4aa8

Browse files
committed
Don't collect into a Vec that is immediately being iterated on again.
1 parent 7af445d commit 93c4aa8

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

compiler/rustc_trait_selection/src/opaque_types.rs

+2-3
Original file line numberDiff line numberDiff line change
@@ -344,12 +344,11 @@ impl<'a, 'tcx> InferCtxtExt<'tcx> for InferCtxt<'a, 'tcx> {
344344
// check.)
345345
let bounds = tcx.explicit_item_bounds(def_id);
346346
debug!("{:#?}", bounds);
347-
let bounds: Vec<_> =
348-
bounds.iter().map(|(bound, _)| bound.subst(tcx, opaque_type_key.substs)).collect();
347+
let bounds = bounds.iter().map(|(bound, _)| bound.subst(tcx, opaque_type_key.substs));
349348
debug!("{:#?}", bounds);
350349
let opaque_type = tcx.mk_opaque(def_id, opaque_type_key.substs);
351350

352-
let required_region_bounds = required_region_bounds(tcx, opaque_type, bounds.into_iter());
351+
let required_region_bounds = required_region_bounds(tcx, opaque_type, bounds);
353352
if !required_region_bounds.is_empty() {
354353
for required_region in required_region_bounds {
355354
concrete_ty.visit_with(&mut ConstrainOpaqueTypeRegionVisitor {

0 commit comments

Comments
 (0)