@@ -120,7 +120,7 @@ impl<'a, 'tcx> TypeFolder<TyCtxt<'tcx>> for TypeFreshener<'a, 'tcx> {
120120 t
121121 } else {
122122 match * t. kind ( ) {
123- ty:: Infer ( v) => self . fold_infer_ty ( v) . unwrap_or ( t ) ,
123+ ty:: Infer ( v) => self . fold_infer_ty ( v) ,
124124
125125 // This code is hot enough that a non-debug assertion here makes a noticeable
126126 // difference on benchmarks like `wg-grammar`.
@@ -168,18 +168,18 @@ impl<'a, 'tcx> TypeFolder<TyCtxt<'tcx>> for TypeFreshener<'a, 'tcx> {
168168impl < ' a , ' tcx > TypeFreshener < ' a , ' tcx > {
169169 // This is separate from `fold_ty` to keep that method small and inlinable.
170170 #[ inline( never) ]
171- fn fold_infer_ty ( & mut self , ty : ty:: InferTy ) -> Option < Ty < ' tcx > > {
171+ fn fold_infer_ty ( & mut self , ty : ty:: InferTy ) -> Ty < ' tcx > {
172172 match ty {
173173 ty:: TyVar ( v) => {
174174 let mut inner = self . infcx . inner . borrow_mut ( ) ;
175175 match inner. type_variables ( ) . probe ( v) . known ( ) {
176176 Some ( ty) => {
177177 drop ( inner) ;
178- Some ( ty. fold_with ( self ) )
178+ ty. fold_with ( self )
179179 }
180180 None => {
181181 let input = ty:: TyVar ( inner. type_variables ( ) . root_var ( v) ) ;
182- Some ( self . freshen_ty ( input, |n| Ty :: new_fresh ( self . infcx . tcx , n) ) )
182+ self . freshen_ty ( input, |n| Ty :: new_fresh ( self . infcx . tcx , n) )
183183 }
184184 }
185185 }
@@ -188,11 +188,11 @@ impl<'a, 'tcx> TypeFreshener<'a, 'tcx> {
188188 let mut inner = self . infcx . inner . borrow_mut ( ) ;
189189 let value = inner. int_unification_table ( ) . probe_value ( v) ;
190190 match value {
191- ty:: IntVarValue :: IntType ( ty) => Some ( Ty :: new_int ( self . infcx . tcx , ty) ) ,
192- ty:: IntVarValue :: UintType ( ty) => Some ( Ty :: new_uint ( self . infcx . tcx , ty) ) ,
191+ ty:: IntVarValue :: IntType ( ty) => Ty :: new_int ( self . infcx . tcx , ty) ,
192+ ty:: IntVarValue :: UintType ( ty) => Ty :: new_uint ( self . infcx . tcx , ty) ,
193193 ty:: IntVarValue :: Unknown => {
194194 let input = ty:: IntVar ( inner. int_unification_table ( ) . find ( v) ) ;
195- Some ( self . freshen_ty ( input, |n| Ty :: new_fresh_int ( self . infcx . tcx , n) ) )
195+ self . freshen_ty ( input, |n| Ty :: new_fresh_int ( self . infcx . tcx , n) )
196196 }
197197 }
198198 }
@@ -201,10 +201,10 @@ impl<'a, 'tcx> TypeFreshener<'a, 'tcx> {
201201 let mut inner = self . infcx . inner . borrow_mut ( ) ;
202202 let value = inner. float_unification_table ( ) . probe_value ( v) ;
203203 match value {
204- ty:: FloatVarValue :: Known ( ty) => Some ( Ty :: new_float ( self . infcx . tcx , ty) ) ,
204+ ty:: FloatVarValue :: Known ( ty) => Ty :: new_float ( self . infcx . tcx , ty) ,
205205 ty:: FloatVarValue :: Unknown => {
206206 let input = ty:: FloatVar ( inner. float_unification_table ( ) . find ( v) ) ;
207- Some ( self . freshen_ty ( input, |n| Ty :: new_fresh_float ( self . infcx . tcx , n) ) )
207+ self . freshen_ty ( input, |n| Ty :: new_fresh_float ( self . infcx . tcx , n) )
208208 }
209209 }
210210 }
0 commit comments