Skip to content

Commit

Permalink
small select cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
lcnr committed May 23, 2020
1 parent 75b0a68 commit 82b4fc4
Showing 1 changed file with 6 additions and 19 deletions.
25 changes: 6 additions & 19 deletions src/librustc_trait_selection/traits/select.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1058,20 +1058,11 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
// Heuristics: show the diagnostics when there are no candidates in crate.
if let Ok(candidate_set) = self.assemble_candidates(stack) {
let mut no_candidates_apply = true;
{
let evaluated_candidates =
candidate_set.vec.iter().map(|c| self.evaluate_candidate(stack, &c));

for ec in evaluated_candidates {
match ec {
Ok(c) => {
if c.may_apply() {
no_candidates_apply = false;
break;
}
}
Err(e) => return Err(e.into()),
}

for c in candidate_set.vec.iter() {
if self.evaluate_candidate(stack, &c)?.may_apply() {
no_candidates_apply = false;
break;
}
}

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

// The last field of the tuple has to exist.
let (&a_last, a_mid) = if let Some(x) = tys_a.split_last() {
x
} else {
return Err(Unimplemented);
};
let (&a_last, a_mid) = tys_a.split_last().ok_or(Unimplemented)?;
let &b_last = tys_b.last().unwrap();

// Check that the source tuple with the target's
Expand Down

0 comments on commit 82b4fc4

Please sign in to comment.