diff options
| -rw-r--r-- | compiler/rustc_hir_analysis/src/collect/item_bounds.rs | 2 | ||||
| -rw-r--r-- | compiler/rustc_infer/src/traits/util.rs | 8 | ||||
| -rw-r--r-- | compiler/rustc_middle/src/ty/codec.rs | 2 | ||||
| -rw-r--r-- | compiler/rustc_middle/src/ty/structural_impls.rs | 5 |
4 files changed, 7 insertions, 10 deletions
diff --git a/compiler/rustc_hir_analysis/src/collect/item_bounds.rs b/compiler/rustc_hir_analysis/src/collect/item_bounds.rs index e9763048288..958313fee6f 100644 --- a/compiler/rustc_hir_analysis/src/collect/item_bounds.rs +++ b/compiler/rustc_hir_analysis/src/collect/item_bounds.rs @@ -47,7 +47,7 @@ fn associated_type_bounds<'tcx>( } _ => false, }) - .map(|(pred, span)| (pred.as_clause().unwrap(), span)); + .map(|(pred, span)| (pred.expect_clause(), span)); let all_bounds = tcx.arena.alloc_from_iter(bounds.clauses().chain(bounds_from_parent)); debug!( diff --git a/compiler/rustc_infer/src/traits/util.rs b/compiler/rustc_infer/src/traits/util.rs index a6475a766c4..26919872952 100644 --- a/compiler/rustc_infer/src/traits/util.rs +++ b/compiler/rustc_infer/src/traits/util.rs @@ -173,7 +173,7 @@ impl<'tcx> Elaboratable<'tcx> for (ty::Clause<'tcx>, Span) { } fn child(&self, predicate: ty::Predicate<'tcx>) -> Self { - (predicate.as_clause().unwrap(), self.1) + (predicate.expect_clause(), self.1) } fn child_with_derived_cause( @@ -183,7 +183,7 @@ impl<'tcx> Elaboratable<'tcx> for (ty::Clause<'tcx>, Span) { _parent_trait_pred: ty::PolyTraitPredicate<'tcx>, _index: usize, ) -> Self { - (predicate.as_clause().unwrap(), self.1) + (predicate.expect_clause(), self.1) } } @@ -193,7 +193,7 @@ impl<'tcx> Elaboratable<'tcx> for ty::Clause<'tcx> { } fn child(&self, predicate: ty::Predicate<'tcx>) -> Self { - predicate.as_clause().unwrap() + predicate.expect_clause() } fn child_with_derived_cause( @@ -203,7 +203,7 @@ impl<'tcx> Elaboratable<'tcx> for ty::Clause<'tcx> { _parent_trait_pred: ty::PolyTraitPredicate<'tcx>, _index: usize, ) -> Self { - predicate.as_clause().unwrap() + predicate.expect_clause() } } diff --git a/compiler/rustc_middle/src/ty/codec.rs b/compiler/rustc_middle/src/ty/codec.rs index d252a3fda54..e2771fc53e7 100644 --- a/compiler/rustc_middle/src/ty/codec.rs +++ b/compiler/rustc_middle/src/ty/codec.rs @@ -250,7 +250,7 @@ impl<'tcx, D: TyDecoder<I = TyCtxt<'tcx>>> Decodable<D> for ty::Predicate<'tcx> impl<'tcx, D: TyDecoder<I = TyCtxt<'tcx>>> Decodable<D> for ty::Clause<'tcx> { fn decode(decoder: &mut D) -> ty::Clause<'tcx> { let pred: ty::Predicate<'tcx> = Decodable::decode(decoder); - pred.as_clause().unwrap() + pred.expect_clause() } } diff --git a/compiler/rustc_middle/src/ty/structural_impls.rs b/compiler/rustc_middle/src/ty/structural_impls.rs index 2817d7256de..959bf032a83 100644 --- a/compiler/rustc_middle/src/ty/structural_impls.rs +++ b/compiler/rustc_middle/src/ty/structural_impls.rs @@ -666,10 +666,7 @@ impl<'tcx> TypeFoldable<TyCtxt<'tcx>> for ty::Clause<'tcx> { self, folder: &mut F, ) -> Result<Self, F::Error> { - Ok(folder - .try_fold_predicate(self.as_predicate())? - .as_clause() - .expect("no sensible folder would do this")) + Ok(folder.try_fold_predicate(self.as_predicate())?.expect_clause()) } } |
