@@ -796,7 +796,7 @@ impl Field {
796796 VariantDef :: Variant ( it) => it. parent . id . into ( ) ,
797797 } ;
798798 let substs = TyBuilder :: type_params_subst ( db, generic_def_id) ;
799- let ty = db. field_types ( var_id) [ self . id ] . clone ( ) . substitute ( & Interner , & substs) ;
799+ let ty = db. field_types ( var_id) [ self . id ] . clone ( ) . substitute ( Interner , & substs) ;
800800 Type :: new ( db, self . parent . module ( db) . id . krate ( ) , var_id, ty)
801801 }
802802
@@ -2136,7 +2136,7 @@ impl TypeParam {
21362136 pub fn ty ( self , db : & dyn HirDatabase ) -> Type {
21372137 let resolver = self . id . parent . resolver ( db. upcast ( ) ) ;
21382138 let krate = self . id . parent . module ( db. upcast ( ) ) . krate ( ) ;
2139- let ty = TyKind :: Placeholder ( hir_ty:: to_placeholder_idx ( db, self . id ) ) . intern ( & Interner ) ;
2139+ let ty = TyKind :: Placeholder ( hir_ty:: to_placeholder_idx ( db, self . id ) ) . intern ( Interner ) ;
21402140 Type :: new_with_resolver_inner ( db, krate, & resolver, ty)
21412141 }
21422142
@@ -2159,7 +2159,7 @@ impl TypeParam {
21592159 let krate = self . id . parent . module ( db. upcast ( ) ) . krate ( ) ;
21602160 let ty = params. get ( local_idx) ?. clone ( ) ;
21612161 let subst = TyBuilder :: type_params_subst ( db, self . id . parent ) ;
2162- let ty = ty. substitute ( & Interner , & subst_prefix ( & subst, local_idx) ) ;
2162+ let ty = ty. substitute ( Interner , & subst_prefix ( & subst, local_idx) ) ;
21632163 Some ( Type :: new_with_resolver_inner ( db, krate, & resolver, ty) )
21642164 }
21652165}
@@ -2381,31 +2381,31 @@ impl Type {
23812381 }
23822382
23832383 pub fn is_unit ( & self ) -> bool {
2384- matches ! ( self . ty. kind( & Interner ) , TyKind :: Tuple ( 0 , ..) )
2384+ matches ! ( self . ty. kind( Interner ) , TyKind :: Tuple ( 0 , ..) )
23852385 }
23862386
23872387 pub fn is_bool ( & self ) -> bool {
2388- matches ! ( self . ty. kind( & Interner ) , TyKind :: Scalar ( Scalar :: Bool ) )
2388+ matches ! ( self . ty. kind( Interner ) , TyKind :: Scalar ( Scalar :: Bool ) )
23892389 }
23902390
23912391 pub fn is_never ( & self ) -> bool {
2392- matches ! ( self . ty. kind( & Interner ) , TyKind :: Never )
2392+ matches ! ( self . ty. kind( Interner ) , TyKind :: Never )
23932393 }
23942394
23952395 pub fn is_mutable_reference ( & self ) -> bool {
2396- matches ! ( self . ty. kind( & Interner ) , TyKind :: Ref ( hir_ty:: Mutability :: Mut , ..) )
2396+ matches ! ( self . ty. kind( Interner ) , TyKind :: Ref ( hir_ty:: Mutability :: Mut , ..) )
23972397 }
23982398
23992399 pub fn is_reference ( & self ) -> bool {
2400- matches ! ( self . ty. kind( & Interner ) , TyKind :: Ref ( ..) )
2400+ matches ! ( self . ty. kind( Interner ) , TyKind :: Ref ( ..) )
24012401 }
24022402
24032403 pub fn is_usize ( & self ) -> bool {
2404- matches ! ( self . ty. kind( & Interner ) , TyKind :: Scalar ( Scalar :: Uint ( UintTy :: Usize ) ) )
2404+ matches ! ( self . ty. kind( Interner ) , TyKind :: Scalar ( Scalar :: Uint ( UintTy :: Usize ) ) )
24052405 }
24062406
24072407 pub fn remove_ref ( & self ) -> Option < Type > {
2408- match & self . ty . kind ( & Interner ) {
2408+ match & self . ty . kind ( Interner ) {
24092409 TyKind :: Ref ( .., ty) => Some ( self . derived ( ty. clone ( ) ) ) ,
24102410 _ => None ,
24112411 }
@@ -2434,7 +2434,7 @@ impl Type {
24342434 } ;
24352435
24362436 let canonical_ty =
2437- Canonical { value : self . ty . clone ( ) , binders : CanonicalVarKinds :: empty ( & Interner ) } ;
2437+ Canonical { value : self . ty . clone ( ) , binders : CanonicalVarKinds :: empty ( Interner ) } ;
24382438 method_resolution:: implements_trait (
24392439 & canonical_ty,
24402440 db,
@@ -2457,7 +2457,7 @@ impl Type {
24572457 } ;
24582458
24592459 let canonical_ty =
2460- Canonical { value : self . ty . clone ( ) , binders : CanonicalVarKinds :: empty ( & Interner ) } ;
2460+ Canonical { value : self . ty . clone ( ) , binders : CanonicalVarKinds :: empty ( Interner ) } ;
24612461 method_resolution:: implements_trait_unique (
24622462 & canonical_ty,
24632463 db,
@@ -2474,8 +2474,8 @@ impl Type {
24742474 . build ( ) ;
24752475
24762476 let goal = Canonical {
2477- value : hir_ty:: InEnvironment :: new ( & self . env . env , trait_ref. cast ( & Interner ) ) ,
2478- binders : CanonicalVarKinds :: empty ( & Interner ) ,
2477+ value : hir_ty:: InEnvironment :: new ( & self . env . env , trait_ref. cast ( Interner ) ) ,
2478+ binders : CanonicalVarKinds :: empty ( Interner ) ,
24792479 } ;
24802480
24812481 db. trait_solve ( self . krate , goal) . is_some ( )
@@ -2497,9 +2497,9 @@ impl Type {
24972497 AliasEq {
24982498 alias : AliasTy :: Projection ( projection) ,
24992499 ty : TyKind :: BoundVar ( BoundVar :: new ( DebruijnIndex :: INNERMOST , 0 ) )
2500- . intern ( & Interner ) ,
2500+ . intern ( Interner ) ,
25012501 }
2502- . cast ( & Interner ) ,
2502+ . cast ( Interner ) ,
25032503 ) ,
25042504 [ TyVariableKind :: General ] . into_iter ( ) ,
25052505 ) ;
@@ -2508,9 +2508,9 @@ impl Type {
25082508 Solution :: Unique ( s) => s
25092509 . value
25102510 . subst
2511- . as_slice ( & Interner )
2511+ . as_slice ( Interner )
25122512 . first ( )
2513- . map ( |ty| self . derived ( ty. assert_ty_ref ( & Interner ) . clone ( ) ) ) ,
2513+ . map ( |ty| self . derived ( ty. assert_ty_ref ( Interner ) . clone ( ) ) ) ,
25142514 Solution :: Ambig ( _) => None ,
25152515 }
25162516 }
@@ -2532,15 +2532,15 @@ impl Type {
25322532 }
25332533
25342534 pub fn is_closure ( & self ) -> bool {
2535- matches ! ( & self . ty. kind( & Interner ) , TyKind :: Closure { .. } )
2535+ matches ! ( & self . ty. kind( Interner ) , TyKind :: Closure { .. } )
25362536 }
25372537
25382538 pub fn is_fn ( & self ) -> bool {
2539- matches ! ( & self . ty. kind( & Interner ) , TyKind :: FnDef ( ..) | TyKind :: Function { .. } )
2539+ matches ! ( & self . ty. kind( Interner ) , TyKind :: FnDef ( ..) | TyKind :: Function { .. } )
25402540 }
25412541
25422542 pub fn is_packed ( & self , db : & dyn HirDatabase ) -> bool {
2543- let adt_id = match * self . ty . kind ( & Interner ) {
2543+ let adt_id = match * self . ty . kind ( Interner ) {
25442544 TyKind :: Adt ( hir_ty:: AdtId ( adt_id) , ..) => adt_id,
25452545 _ => return false ,
25462546 } ;
@@ -2553,14 +2553,14 @@ impl Type {
25532553 }
25542554
25552555 pub fn is_raw_ptr ( & self ) -> bool {
2556- matches ! ( & self . ty. kind( & Interner ) , TyKind :: Raw ( ..) )
2556+ matches ! ( & self . ty. kind( Interner ) , TyKind :: Raw ( ..) )
25572557 }
25582558
25592559 pub fn contains_unknown ( & self ) -> bool {
25602560 return go ( & self . ty ) ;
25612561
25622562 fn go ( ty : & Ty ) -> bool {
2563- match ty. kind ( & Interner ) {
2563+ match ty. kind ( Interner ) {
25642564 TyKind :: Error => true ,
25652565
25662566 TyKind :: Adt ( _, substs)
@@ -2569,7 +2569,7 @@ impl Type {
25692569 | TyKind :: OpaqueType ( _, substs)
25702570 | TyKind :: FnDef ( _, substs)
25712571 | TyKind :: Closure ( _, substs) => {
2572- substs. iter ( & Interner ) . filter_map ( |a| a. ty ( & Interner ) ) . any ( go)
2572+ substs. iter ( Interner ) . filter_map ( |a| a. ty ( Interner ) ) . any ( go)
25732573 }
25742574
25752575 TyKind :: Array ( _ty, len) if len. is_unknown ( ) => true ,
@@ -2595,7 +2595,7 @@ impl Type {
25952595 }
25962596
25972597 pub fn fields ( & self , db : & dyn HirDatabase ) -> Vec < ( Field , Type ) > {
2598- let ( variant_id, substs) = match self . ty . kind ( & Interner ) {
2598+ let ( variant_id, substs) = match self . ty . kind ( Interner ) {
25992599 TyKind :: Adt ( hir_ty:: AdtId ( AdtId :: StructId ( s) ) , substs) => ( ( * s) . into ( ) , substs) ,
26002600 TyKind :: Adt ( hir_ty:: AdtId ( AdtId :: UnionId ( u) ) , substs) => ( ( * u) . into ( ) , substs) ,
26012601 _ => return Vec :: new ( ) ,
@@ -2605,17 +2605,17 @@ impl Type {
26052605 . iter ( )
26062606 . map ( |( local_id, ty) | {
26072607 let def = Field { parent : variant_id. into ( ) , id : local_id } ;
2608- let ty = ty. clone ( ) . substitute ( & Interner , substs) ;
2608+ let ty = ty. clone ( ) . substitute ( Interner , substs) ;
26092609 ( def, self . derived ( ty) )
26102610 } )
26112611 . collect ( )
26122612 }
26132613
26142614 pub fn tuple_fields ( & self , _db : & dyn HirDatabase ) -> Vec < Type > {
2615- if let TyKind :: Tuple ( _, substs) = & self . ty . kind ( & Interner ) {
2615+ if let TyKind :: Tuple ( _, substs) = & self . ty . kind ( Interner ) {
26162616 substs
2617- . iter ( & Interner )
2618- . map ( |ty| self . derived ( ty. assert_ty_ref ( & Interner ) . clone ( ) ) )
2617+ . iter ( Interner )
2618+ . map ( |ty| self . derived ( ty. assert_ty_ref ( Interner ) . clone ( ) ) )
26192619 . collect ( )
26202620 } else {
26212621 Vec :: new ( )
@@ -2678,8 +2678,8 @@ impl Type {
26782678 . strip_references ( )
26792679 . as_adt ( )
26802680 . into_iter ( )
2681- . flat_map ( |( _, substs) | substs. iter ( & Interner ) )
2682- . filter_map ( |arg| arg. ty ( & Interner ) . cloned ( ) )
2681+ . flat_map ( |( _, substs) | substs. iter ( Interner ) )
2682+ . filter_map ( |arg| arg. ty ( Interner ) . cloned ( ) )
26832683 . map ( move |ty| self . derived ( ty) )
26842684 }
26852685
@@ -2819,7 +2819,7 @@ impl Type {
28192819 pub fn env_traits < ' a > ( & ' a self , db : & ' a dyn HirDatabase ) -> impl Iterator < Item = Trait > + ' a {
28202820 let _p = profile:: span ( "env_traits" ) ;
28212821 self . autoderef_ ( db)
2822- . filter ( |ty| matches ! ( ty. kind( & Interner ) , TyKind :: Placeholder ( _) ) )
2822+ . filter ( |ty| matches ! ( ty. kind( Interner ) , TyKind :: Placeholder ( _) ) )
28232823 . flat_map ( |ty| {
28242824 self . env
28252825 . traits_in_scope_from_clauses ( ty)
@@ -2857,7 +2857,7 @@ impl Type {
28572857 substs : & Substitution ,
28582858 cb : & mut impl FnMut ( Type ) ,
28592859 ) {
2860- for ty in substs. iter ( & Interner ) . filter_map ( |a| a. ty ( & Interner ) ) {
2860+ for ty in substs. iter ( Interner ) . filter_map ( |a| a. ty ( Interner ) ) {
28612861 walk_type ( db, & type_. derived ( ty. clone ( ) ) , cb) ;
28622862 }
28632863 }
@@ -2872,11 +2872,8 @@ impl Type {
28722872 if let WhereClause :: Implemented ( trait_ref) = pred. skip_binders ( ) {
28732873 cb ( type_. clone ( ) ) ;
28742874 // skip the self type. it's likely the type we just got the bounds from
2875- for ty in trait_ref
2876- . substitution
2877- . iter ( & Interner )
2878- . skip ( 1 )
2879- . filter_map ( |a| a. ty ( & Interner ) )
2875+ for ty in
2876+ trait_ref. substitution . iter ( Interner ) . skip ( 1 ) . filter_map ( |a| a. ty ( Interner ) )
28802877 {
28812878 walk_type ( db, & type_. derived ( ty. clone ( ) ) , cb) ;
28822879 }
@@ -2886,7 +2883,7 @@ impl Type {
28862883
28872884 fn walk_type ( db : & dyn HirDatabase , type_ : & Type , cb : & mut impl FnMut ( Type ) ) {
28882885 let ty = type_. ty . strip_references ( ) ;
2889- match ty. kind ( & Interner ) {
2886+ match ty. kind ( Interner ) {
28902887 TyKind :: Adt ( _, substs) => {
28912888 cb ( type_. derived ( ty. clone ( ) ) ) ;
28922889 walk_substs ( db, type_, substs, cb) ;
0 commit comments