@@ -1368,8 +1368,7 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> {
1368
1368
1369
1369
// Winnow, but record the exact outcome of evaluation, which
1370
1370
// 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 ( )
1373
1372
. map ( |c| match self . evaluate_candidate ( stack, & c) {
1374
1373
Ok ( eval) if eval. may_apply ( ) => Ok ( Some ( EvaluatedCandidate {
1375
1374
candidate : c,
@@ -1378,10 +1377,8 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> {
1378
1377
Ok ( _) => Ok ( None ) ,
1379
1378
Err ( OverflowError ) => Err ( Overflow ) ,
1380
1379
} )
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 < _ > , _ > > ( ) ?;
1385
1382
1386
1383
debug ! (
1387
1384
"winnowed to {} candidates for {:?}: {:?}" ,
@@ -1390,7 +1387,7 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> {
1390
1387
candidates
1391
1388
) ;
1392
1389
1393
- // If there are STILL multiple candidate , we can further
1390
+ // If there are STILL multiple candidates , we can further
1394
1391
// reduce the list by dropping duplicates -- including
1395
1392
// resolving specializations.
1396
1393
if candidates. len ( ) > 1 {
0 commit comments