diff --git a/compiler/rustc_middle/src/ty/subst.rs b/compiler/rustc_middle/src/ty/subst.rs index cf97344f18e76..c723df83905da 100644 --- a/compiler/rustc_middle/src/ty/subst.rs +++ b/compiler/rustc_middle/src/ty/subst.rs @@ -396,15 +396,7 @@ impl<'tcx> TypeFoldable<'tcx> for SubstsRef<'tcx> { } } 0 => Ok(self), - _ => { - let params: SmallVec<[_; 8]> = - self.iter().map(|k| k.try_fold_with(folder)).collect::>()?; - if params[..] == self[..] { - Ok(self) - } else { - Ok(folder.tcx().intern_substs(¶ms)) - } - } + _ => ty::util::fold_list(self, folder, |tcx, v| tcx.intern_substs(v)), } }