]> git.lizzy.rs Git - rust.git/commitdiff
remove trivial `mk_predicate`s
authorBastian Kauschke <bastian_kauschke@hotmail.de>
Fri, 29 May 2020 19:04:01 +0000 (21:04 +0200)
committerBastian Kauschke <bastian_kauschke@hotmail.de>
Fri, 29 May 2020 19:04:01 +0000 (21:04 +0200)
src/librustc_middle/ty/structural_impls.rs

index c6ecb08615fcf122fe5e49d3d230d57eac1ed27f..7eefd1419a311ce954808cfa62baace0da794896 100644 (file)
@@ -987,7 +987,8 @@ fn visit_with<V: TypeVisitor<'tcx>>(&self, visitor: &mut V) -> bool {
 
 impl<'tcx> TypeFoldable<'tcx> for ty::Predicate<'tcx> {
     fn super_fold_with<F: TypeFolder<'tcx>>(&self, folder: &mut F) -> Self {
-        folder.tcx().mk_predicate(ty::PredicateKind::super_fold_with(self.kind, folder))
+        let new = ty::PredicateKind::super_fold_with(self.kind, folder);
+        if new != *self.kind { folder.tcx().mk_predicate(new) } else { *self }
     }
 
     fn super_visit_with<V: TypeVisitor<'tcx>>(&self, visitor: &mut V) -> bool {