Skip to content

Commit 6cb1c0e

Browse files
authored
Rollup merge of #72517 - lcnr:refactor-winnowing, r=jonas-schievink
small select cleanup
2 parents fb848a6 + 82b4fc4 commit 6cb1c0e

File tree

1 file changed

+6
-19
lines changed

1 file changed

+6
-19
lines changed

src/librustc_trait_selection/traits/select.rs

+6-19
Original file line numberDiff line numberDiff line change
@@ -1058,20 +1058,11 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
10581058
// Heuristics: show the diagnostics when there are no candidates in crate.
10591059
if let Ok(candidate_set) = self.assemble_candidates(stack) {
10601060
let mut no_candidates_apply = true;
1061-
{
1062-
let evaluated_candidates =
1063-
candidate_set.vec.iter().map(|c| self.evaluate_candidate(stack, &c));
1064-
1065-
for ec in evaluated_candidates {
1066-
match ec {
1067-
Ok(c) => {
1068-
if c.may_apply() {
1069-
no_candidates_apply = false;
1070-
break;
1071-
}
1072-
}
1073-
Err(e) => return Err(e.into()),
1074-
}
1061+
1062+
for c in candidate_set.vec.iter() {
1063+
if self.evaluate_candidate(stack, &c)?.may_apply() {
1064+
no_candidates_apply = false;
1065+
break;
10751066
}
10761067
}
10771068

@@ -3182,11 +3173,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
31823173
assert_eq!(tys_a.len(), tys_b.len());
31833174

31843175
// The last field of the tuple has to exist.
3185-
let (&a_last, a_mid) = if let Some(x) = tys_a.split_last() {
3186-
x
3187-
} else {
3188-
return Err(Unimplemented);
3189-
};
3176+
let (&a_last, a_mid) = tys_a.split_last().ok_or(Unimplemented)?;
31903177
let &b_last = tys_b.last().unwrap();
31913178

31923179
// Check that the source tuple with the target's

0 commit comments

Comments
 (0)