diff options
| author | Ralf Jung <post@ralfj.de> | 2020-05-24 09:30:37 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-05-24 09:30:37 +0200 |
| commit | 6cb1c0eb64c28742e9d228027d04fe3ebc190e46 (patch) | |
| tree | cde25375d9a3bfd9e6429df7f7716a94015938ac /src | |
| parent | fb848a6b7daf63d5cd51b167565a400c3ec42d6a (diff) | |
| parent | 82b4fc42fdbbb1132f5a98ded198828e4175da66 (diff) | |
| download | rust-6cb1c0eb64c28742e9d228027d04fe3ebc190e46.tar.gz rust-6cb1c0eb64c28742e9d228027d04fe3ebc190e46.zip | |
Rollup merge of #72517 - lcnr:refactor-winnowing, r=jonas-schievink
small select cleanup
Diffstat (limited to 'src')
| -rw-r--r-- | src/librustc_trait_selection/traits/select.rs | 25 |
1 files changed, 6 insertions, 19 deletions
diff --git a/src/librustc_trait_selection/traits/select.rs b/src/librustc_trait_selection/traits/select.rs index b402aba65cd..9b3381066a1 100644 --- a/src/librustc_trait_selection/traits/select.rs +++ b/src/librustc_trait_selection/traits/select.rs @@ -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; } } @@ -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 |
