From 4460a1dc28a10cd74a6e5636d6e2cd8c8f06ba4b Mon Sep 17 00:00:00 2001 From: Nicholas Nethercote Date: Sat, 15 Apr 2023 09:31:11 +1000 Subject: Remove `TypeSuper{Foldable,Visitable}` impls for `Region`. These traits exist so that folders/visitors can recurse into types of interest: binders, types, regions, predicates, and consts. But `Region` is non-recursive and cannot contain other types of interest, so its methods in these traits are trivial. This commit inlines and removes those trivial methods. --- src/librustdoc/clean/auto_trait.rs | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/librustdoc/clean/auto_trait.rs b/src/librustdoc/clean/auto_trait.rs index 9479b3ee036..f6088f4e64a 100644 --- a/src/librustdoc/clean/auto_trait.rs +++ b/src/librustdoc/clean/auto_trait.rs @@ -1,7 +1,7 @@ use rustc_data_structures::fx::FxHashSet; use rustc_hir as hir; use rustc_hir::lang_items::LangItem; -use rustc_middle::ty::{self, Region, RegionVid, TypeFoldable, TypeSuperFoldable}; +use rustc_middle::ty::{self, Region, RegionVid, TypeFoldable}; use rustc_trait_selection::traits::auto_trait::{self, AutoTraitResult}; use thin_vec::ThinVec; @@ -740,10 +740,9 @@ impl<'a, 'tcx> TypeFolder> for RegionReplacer<'a, 'tcx> { } fn fold_region(&mut self, r: ty::Region<'tcx>) -> ty::Region<'tcx> { - (match *r { - ty::ReVar(vid) => self.vid_to_region.get(&vid).cloned(), - _ => None, - }) - .unwrap_or_else(|| r.super_fold_with(self)) + match *r { + ty::ReVar(vid) => self.vid_to_region.get(&vid).cloned().unwrap_or(r), + _ => r, + } } } -- cgit 1.4.1-3-g733a5