@@ -7,9 +7,7 @@ use crate::mir::interpret;
7
7
use crate :: ty:: fold:: { FallibleTypeFolder , TypeFoldable , TypeSuperFoldable } ;
8
8
use crate :: ty:: print:: { with_no_trimmed_paths, FmtPrinter , Printer } ;
9
9
use crate :: ty:: visit:: { TypeSuperVisitable , TypeVisitable , TypeVisitor } ;
10
- use crate :: ty:: {
11
- self , noop_traversal_if_boring, AliasTy , InferConst , Lift , Term , TermKind , Ty , TyCtxt ,
12
- } ;
10
+ use crate :: ty:: { self , AliasTy , InferConst , Lift , Term , TermKind , Ty , TyCtxt } ;
13
11
use rustc_hir:: def:: Namespace ;
14
12
use rustc_target:: abi:: TyAndLayout ;
15
13
use rustc_type_ir:: { ConstKind , DebugWithInfcx , InferCtxtLike , WithInfcx } ;
@@ -721,33 +719,7 @@ impl<'tcx> TypeSuperFoldable<TyCtxt<'tcx>> for ty::Const<'tcx> {
721
719
folder : & mut F ,
722
720
) -> Result < Self , F :: Error > {
723
721
let ty = self . ty ( ) . try_fold_with ( folder) ?;
724
- let kind = match self . kind ( ) {
725
- ConstKind :: Param ( p) => {
726
- ConstKind :: Param ( noop_traversal_if_boring ! ( p. try_fold_with( folder) ) ?)
727
- }
728
- ConstKind :: Infer ( i) => {
729
- ConstKind :: Infer ( noop_traversal_if_boring ! ( i. try_fold_with( folder) ) ?)
730
- }
731
- ConstKind :: Bound ( d, b) => ConstKind :: Bound (
732
- noop_traversal_if_boring ! ( d. try_fold_with( folder) ) ?,
733
- noop_traversal_if_boring ! ( b. try_fold_with( folder) ) ?,
734
- ) ,
735
- ConstKind :: Placeholder ( p) => {
736
- ConstKind :: Placeholder ( noop_traversal_if_boring ! ( p. try_fold_with( folder) ) ?)
737
- }
738
- ConstKind :: Unevaluated ( uv) => {
739
- ConstKind :: Unevaluated ( noop_traversal_if_boring ! ( uv. try_fold_with( folder) ) ?)
740
- }
741
- ConstKind :: Value ( v) => {
742
- ConstKind :: Value ( noop_traversal_if_boring ! ( v. try_fold_with( folder) ) ?)
743
- }
744
- ConstKind :: Error ( e) => {
745
- ConstKind :: Error ( noop_traversal_if_boring ! ( e. try_fold_with( folder) ) ?)
746
- }
747
- ConstKind :: Expr ( e) => {
748
- ConstKind :: Expr ( noop_traversal_if_boring ! ( e. try_fold_with( folder) ) ?)
749
- }
750
- } ;
722
+ let kind = self . kind ( ) . try_fold_with ( folder) ?;
751
723
if ty != self . ty ( ) || kind != self . kind ( ) {
752
724
Ok ( folder. interner ( ) . mk_ct_from_kind ( kind, ty) )
753
725
} else {
@@ -762,23 +734,7 @@ impl<'tcx> TypeSuperVisitable<TyCtxt<'tcx>> for ty::Const<'tcx> {
762
734
visitor : & mut V ,
763
735
) -> ControlFlow < V :: BreakTy > {
764
736
self . ty ( ) . visit_with ( visitor) ?;
765
- match & self . kind ( ) {
766
- ConstKind :: Param ( p) => noop_traversal_if_boring ! ( p. visit_with( visitor) ) ,
767
- ConstKind :: Infer ( i) => noop_traversal_if_boring ! ( i. visit_with( visitor) ) ,
768
- ConstKind :: Bound ( d, b) => {
769
- noop_traversal_if_boring ! ( d. visit_with( visitor) ) ?;
770
- noop_traversal_if_boring ! ( b. visit_with( visitor) )
771
- }
772
- ConstKind :: Placeholder ( p) => {
773
- noop_traversal_if_boring ! ( p. visit_with( visitor) )
774
- }
775
- ConstKind :: Unevaluated ( uv) => {
776
- noop_traversal_if_boring ! ( uv. visit_with( visitor) )
777
- }
778
- ConstKind :: Value ( v) => noop_traversal_if_boring ! ( v. visit_with( visitor) ) ,
779
- ConstKind :: Error ( e) => noop_traversal_if_boring ! ( e. visit_with( visitor) ) ,
780
- ConstKind :: Expr ( e) => noop_traversal_if_boring ! ( e. visit_with( visitor) ) ,
781
- }
737
+ self . kind ( ) . visit_with ( visitor)
782
738
}
783
739
}
784
740
0 commit comments