@@ -796,7 +796,7 @@ impl Field {
796
796
VariantDef :: Variant ( it) => it. parent . id . into ( ) ,
797
797
} ;
798
798
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) ;
800
800
Type :: new ( db, self . parent . module ( db) . id . krate ( ) , var_id, ty)
801
801
}
802
802
@@ -2136,7 +2136,7 @@ impl TypeParam {
2136
2136
pub fn ty ( self , db : & dyn HirDatabase ) -> Type {
2137
2137
let resolver = self . id . parent . resolver ( db. upcast ( ) ) ;
2138
2138
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 ) ;
2140
2140
Type :: new_with_resolver_inner ( db, krate, & resolver, ty)
2141
2141
}
2142
2142
@@ -2159,7 +2159,7 @@ impl TypeParam {
2159
2159
let krate = self . id . parent . module ( db. upcast ( ) ) . krate ( ) ;
2160
2160
let ty = params. get ( local_idx) ?. clone ( ) ;
2161
2161
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) ) ;
2163
2163
Some ( Type :: new_with_resolver_inner ( db, krate, & resolver, ty) )
2164
2164
}
2165
2165
}
@@ -2381,31 +2381,31 @@ impl Type {
2381
2381
}
2382
2382
2383
2383
pub fn is_unit ( & self ) -> bool {
2384
- matches ! ( self . ty. kind( & Interner ) , TyKind :: Tuple ( 0 , ..) )
2384
+ matches ! ( self . ty. kind( Interner ) , TyKind :: Tuple ( 0 , ..) )
2385
2385
}
2386
2386
2387
2387
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 ) )
2389
2389
}
2390
2390
2391
2391
pub fn is_never ( & self ) -> bool {
2392
- matches ! ( self . ty. kind( & Interner ) , TyKind :: Never )
2392
+ matches ! ( self . ty. kind( Interner ) , TyKind :: Never )
2393
2393
}
2394
2394
2395
2395
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 , ..) )
2397
2397
}
2398
2398
2399
2399
pub fn is_reference ( & self ) -> bool {
2400
- matches ! ( self . ty. kind( & Interner ) , TyKind :: Ref ( ..) )
2400
+ matches ! ( self . ty. kind( Interner ) , TyKind :: Ref ( ..) )
2401
2401
}
2402
2402
2403
2403
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 ) ) )
2405
2405
}
2406
2406
2407
2407
pub fn remove_ref ( & self ) -> Option < Type > {
2408
- match & self . ty . kind ( & Interner ) {
2408
+ match & self . ty . kind ( Interner ) {
2409
2409
TyKind :: Ref ( .., ty) => Some ( self . derived ( ty. clone ( ) ) ) ,
2410
2410
_ => None ,
2411
2411
}
@@ -2434,7 +2434,7 @@ impl Type {
2434
2434
} ;
2435
2435
2436
2436
let canonical_ty =
2437
- Canonical { value : self . ty . clone ( ) , binders : CanonicalVarKinds :: empty ( & Interner ) } ;
2437
+ Canonical { value : self . ty . clone ( ) , binders : CanonicalVarKinds :: empty ( Interner ) } ;
2438
2438
method_resolution:: implements_trait (
2439
2439
& canonical_ty,
2440
2440
db,
@@ -2457,7 +2457,7 @@ impl Type {
2457
2457
} ;
2458
2458
2459
2459
let canonical_ty =
2460
- Canonical { value : self . ty . clone ( ) , binders : CanonicalVarKinds :: empty ( & Interner ) } ;
2460
+ Canonical { value : self . ty . clone ( ) , binders : CanonicalVarKinds :: empty ( Interner ) } ;
2461
2461
method_resolution:: implements_trait_unique (
2462
2462
& canonical_ty,
2463
2463
db,
@@ -2474,8 +2474,8 @@ impl Type {
2474
2474
. build ( ) ;
2475
2475
2476
2476
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 ) ,
2479
2479
} ;
2480
2480
2481
2481
db. trait_solve ( self . krate , goal) . is_some ( )
@@ -2497,9 +2497,9 @@ impl Type {
2497
2497
AliasEq {
2498
2498
alias : AliasTy :: Projection ( projection) ,
2499
2499
ty : TyKind :: BoundVar ( BoundVar :: new ( DebruijnIndex :: INNERMOST , 0 ) )
2500
- . intern ( & Interner ) ,
2500
+ . intern ( Interner ) ,
2501
2501
}
2502
- . cast ( & Interner ) ,
2502
+ . cast ( Interner ) ,
2503
2503
) ,
2504
2504
[ TyVariableKind :: General ] . into_iter ( ) ,
2505
2505
) ;
@@ -2508,9 +2508,9 @@ impl Type {
2508
2508
Solution :: Unique ( s) => s
2509
2509
. value
2510
2510
. subst
2511
- . as_slice ( & Interner )
2511
+ . as_slice ( Interner )
2512
2512
. first ( )
2513
- . map ( |ty| self . derived ( ty. assert_ty_ref ( & Interner ) . clone ( ) ) ) ,
2513
+ . map ( |ty| self . derived ( ty. assert_ty_ref ( Interner ) . clone ( ) ) ) ,
2514
2514
Solution :: Ambig ( _) => None ,
2515
2515
}
2516
2516
}
@@ -2532,15 +2532,15 @@ impl Type {
2532
2532
}
2533
2533
2534
2534
pub fn is_closure ( & self ) -> bool {
2535
- matches ! ( & self . ty. kind( & Interner ) , TyKind :: Closure { .. } )
2535
+ matches ! ( & self . ty. kind( Interner ) , TyKind :: Closure { .. } )
2536
2536
}
2537
2537
2538
2538
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 { .. } )
2540
2540
}
2541
2541
2542
2542
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 ) {
2544
2544
TyKind :: Adt ( hir_ty:: AdtId ( adt_id) , ..) => adt_id,
2545
2545
_ => return false ,
2546
2546
} ;
@@ -2553,14 +2553,14 @@ impl Type {
2553
2553
}
2554
2554
2555
2555
pub fn is_raw_ptr ( & self ) -> bool {
2556
- matches ! ( & self . ty. kind( & Interner ) , TyKind :: Raw ( ..) )
2556
+ matches ! ( & self . ty. kind( Interner ) , TyKind :: Raw ( ..) )
2557
2557
}
2558
2558
2559
2559
pub fn contains_unknown ( & self ) -> bool {
2560
2560
return go ( & self . ty ) ;
2561
2561
2562
2562
fn go ( ty : & Ty ) -> bool {
2563
- match ty. kind ( & Interner ) {
2563
+ match ty. kind ( Interner ) {
2564
2564
TyKind :: Error => true ,
2565
2565
2566
2566
TyKind :: Adt ( _, substs)
@@ -2569,7 +2569,7 @@ impl Type {
2569
2569
| TyKind :: OpaqueType ( _, substs)
2570
2570
| TyKind :: FnDef ( _, substs)
2571
2571
| 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)
2573
2573
}
2574
2574
2575
2575
TyKind :: Array ( _ty, len) if len. is_unknown ( ) => true ,
@@ -2595,7 +2595,7 @@ impl Type {
2595
2595
}
2596
2596
2597
2597
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 ) {
2599
2599
TyKind :: Adt ( hir_ty:: AdtId ( AdtId :: StructId ( s) ) , substs) => ( ( * s) . into ( ) , substs) ,
2600
2600
TyKind :: Adt ( hir_ty:: AdtId ( AdtId :: UnionId ( u) ) , substs) => ( ( * u) . into ( ) , substs) ,
2601
2601
_ => return Vec :: new ( ) ,
@@ -2605,17 +2605,17 @@ impl Type {
2605
2605
. iter ( )
2606
2606
. map ( |( local_id, ty) | {
2607
2607
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) ;
2609
2609
( def, self . derived ( ty) )
2610
2610
} )
2611
2611
. collect ( )
2612
2612
}
2613
2613
2614
2614
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 ) {
2616
2616
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 ( ) ) )
2619
2619
. collect ( )
2620
2620
} else {
2621
2621
Vec :: new ( )
@@ -2678,8 +2678,8 @@ impl Type {
2678
2678
. strip_references ( )
2679
2679
. as_adt ( )
2680
2680
. 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 ( ) )
2683
2683
. map ( move |ty| self . derived ( ty) )
2684
2684
}
2685
2685
@@ -2819,7 +2819,7 @@ impl Type {
2819
2819
pub fn env_traits < ' a > ( & ' a self , db : & ' a dyn HirDatabase ) -> impl Iterator < Item = Trait > + ' a {
2820
2820
let _p = profile:: span ( "env_traits" ) ;
2821
2821
self . autoderef_ ( db)
2822
- . filter ( |ty| matches ! ( ty. kind( & Interner ) , TyKind :: Placeholder ( _) ) )
2822
+ . filter ( |ty| matches ! ( ty. kind( Interner ) , TyKind :: Placeholder ( _) ) )
2823
2823
. flat_map ( |ty| {
2824
2824
self . env
2825
2825
. traits_in_scope_from_clauses ( ty)
@@ -2857,7 +2857,7 @@ impl Type {
2857
2857
substs : & Substitution ,
2858
2858
cb : & mut impl FnMut ( Type ) ,
2859
2859
) {
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 ) ) {
2861
2861
walk_type ( db, & type_. derived ( ty. clone ( ) ) , cb) ;
2862
2862
}
2863
2863
}
@@ -2872,11 +2872,8 @@ impl Type {
2872
2872
if let WhereClause :: Implemented ( trait_ref) = pred. skip_binders ( ) {
2873
2873
cb ( type_. clone ( ) ) ;
2874
2874
// 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 ) )
2880
2877
{
2881
2878
walk_type ( db, & type_. derived ( ty. clone ( ) ) , cb) ;
2882
2879
}
@@ -2886,7 +2883,7 @@ impl Type {
2886
2883
2887
2884
fn walk_type ( db : & dyn HirDatabase , type_ : & Type , cb : & mut impl FnMut ( Type ) ) {
2888
2885
let ty = type_. ty . strip_references ( ) ;
2889
- match ty. kind ( & Interner ) {
2886
+ match ty. kind ( Interner ) {
2890
2887
TyKind :: Adt ( _, substs) => {
2891
2888
cb ( type_. derived ( ty. clone ( ) ) ) ;
2892
2889
walk_substs ( db, type_, substs, cb) ;
0 commit comments