@@ -1368,8 +1368,7 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> {
13681368
13691369 // Winnow, but record the exact outcome of evaluation, which
13701370 // is needed for specialization. Propagate overflow if it occurs.
1371- let candidates: Result < Vec < Option < EvaluatedCandidate < ' _ > > > , _ > = candidates
1372- . into_iter ( )
1371+ let mut candidates = candidates. into_iter ( )
13731372 . map ( |c| match self . evaluate_candidate ( stack, & c) {
13741373 Ok ( eval) if eval. may_apply ( ) => Ok ( Some ( EvaluatedCandidate {
13751374 candidate : c,
@@ -1378,10 +1377,8 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> {
13781377 Ok ( _) => Ok ( None ) ,
13791378 Err ( OverflowError ) => Err ( Overflow ) ,
13801379 } )
1381- . collect ( ) ;
1382-
1383- let mut candidates: Vec < EvaluatedCandidate < ' _ > > =
1384- candidates?. into_iter ( ) . filter_map ( |c| c) . collect ( ) ;
1380+ . flat_map ( Result :: transpose)
1381+ . collect :: < Result < Vec < _ > , _ > > ( ) ?;
13851382
13861383 debug ! (
13871384 "winnowed to {} candidates for {:?}: {:?}" ,
@@ -1390,7 +1387,7 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> {
13901387 candidates
13911388 ) ;
13921389
1393- // If there are STILL multiple candidate , we can further
1390+ // If there are STILL multiple candidates , we can further
13941391 // reduce the list by dropping duplicates -- including
13951392 // resolving specializations.
13961393 if candidates. len ( ) > 1 {
0 commit comments