@@ -569,17 +569,17 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
569
569
. bindings
570
570
. iter ( )
571
571
. map ( |binding| {
572
- let kind = match binding. kind {
573
- hir:: TypeBindingKind :: Equality { ref term } => match term {
574
- hir:: Term :: Ty ( ref ty) => {
572
+ let kind = match & binding. kind {
573
+ hir:: TypeBindingKind :: Equality { term } => match term {
574
+ hir:: Term :: Ty ( ty) => {
575
575
ConvertedBindingKind :: Equality ( self . ast_ty_to_ty ( ty) . into ( ) )
576
576
}
577
- hir:: Term :: Const ( ref c) => {
577
+ hir:: Term :: Const ( c) => {
578
578
let c = Const :: from_anon_const ( self . tcx ( ) , c. def_id ) ;
579
579
ConvertedBindingKind :: Equality ( c. into ( ) )
580
580
}
581
581
} ,
582
- hir:: TypeBindingKind :: Constraint { ref bounds } => {
582
+ hir:: TypeBindingKind :: Constraint { bounds } => {
583
583
ConvertedBindingKind :: Constraint ( bounds)
584
584
}
585
585
} ;
@@ -1928,7 +1928,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
1928
1928
) -> Result < ( Ty < ' tcx > , DefKind , DefId ) , ErrorGuaranteed > {
1929
1929
let tcx = self . tcx ( ) ;
1930
1930
let assoc_ident = assoc_segment. ident ;
1931
- let qself_res = if let hir:: TyKind :: Path ( hir:: QPath :: Resolved ( _, ref path) ) = qself. kind {
1931
+ let qself_res = if let hir:: TyKind :: Path ( hir:: QPath :: Resolved ( _, path) ) = & qself. kind {
1932
1932
path. res
1933
1933
} else {
1934
1934
Res :: Err
@@ -1971,8 +1971,8 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
1971
1971
return ;
1972
1972
} ;
1973
1973
let ( qself_sugg_span, is_self) = if let hir:: TyKind :: Path (
1974
- hir:: QPath :: Resolved ( _, ref path)
1975
- ) = qself. kind {
1974
+ hir:: QPath :: Resolved ( _, path)
1975
+ ) = & qself. kind {
1976
1976
// If the path segment already has type params, we want to overwrite
1977
1977
// them.
1978
1978
match & path. segments [ ..] {
@@ -2760,7 +2760,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
2760
2760
"generic `Self` types are currently not permitted in anonymous constants" ,
2761
2761
) ;
2762
2762
if let Some ( hir:: Node :: Item ( & hir:: Item {
2763
- kind : hir:: ItemKind :: Impl ( ref impl_) ,
2763
+ kind : hir:: ItemKind :: Impl ( impl_) ,
2764
2764
..
2765
2765
} ) ) = tcx. hir ( ) . get_if_local ( def_id)
2766
2766
{
@@ -2843,12 +2843,12 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
2843
2843
fn ast_ty_to_ty_inner ( & self , ast_ty : & hir:: Ty < ' _ > , borrowed : bool , in_path : bool ) -> Ty < ' tcx > {
2844
2844
let tcx = self . tcx ( ) ;
2845
2845
2846
- let result_ty = match ast_ty. kind {
2847
- hir:: TyKind :: Slice ( ref ty) => tcx. mk_slice ( self . ast_ty_to_ty ( ty) ) ,
2848
- hir:: TyKind :: Ptr ( ref mt) => {
2846
+ let result_ty = match & ast_ty. kind {
2847
+ hir:: TyKind :: Slice ( ty) => tcx. mk_slice ( self . ast_ty_to_ty ( ty) ) ,
2848
+ hir:: TyKind :: Ptr ( mt) => {
2849
2849
tcx. mk_ptr ( ty:: TypeAndMut { ty : self . ast_ty_to_ty ( mt. ty ) , mutbl : mt. mutbl } )
2850
2850
}
2851
- hir:: TyKind :: Ref ( ref region, ref mt) => {
2851
+ hir:: TyKind :: Ref ( region, mt) => {
2852
2852
let r = self . ast_region_to_region ( region, None ) ;
2853
2853
debug ! ( ?r) ;
2854
2854
let t = self . ast_ty_to_ty_inner ( mt. ty , true , false ) ;
@@ -2868,38 +2868,38 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
2868
2868
Some ( ast_ty) ,
2869
2869
) )
2870
2870
}
2871
- hir:: TyKind :: TraitObject ( bounds, ref lifetime, repr) => {
2871
+ hir:: TyKind :: TraitObject ( bounds, lifetime, repr) => {
2872
2872
self . maybe_lint_bare_trait ( ast_ty, in_path) ;
2873
2873
let repr = match repr {
2874
2874
TraitObjectSyntax :: Dyn | TraitObjectSyntax :: None => ty:: Dyn ,
2875
2875
TraitObjectSyntax :: DynStar => ty:: DynStar ,
2876
2876
} ;
2877
2877
self . conv_object_ty_poly_trait_ref ( ast_ty. span , bounds, lifetime, borrowed, repr)
2878
2878
}
2879
- hir:: TyKind :: Path ( hir:: QPath :: Resolved ( ref maybe_qself, ref path) ) => {
2879
+ hir:: TyKind :: Path ( hir:: QPath :: Resolved ( maybe_qself, path) ) => {
2880
2880
debug ! ( ?maybe_qself, ?path) ;
2881
2881
let opt_self_ty = maybe_qself. as_ref ( ) . map ( |qself| self . ast_ty_to_ty ( qself) ) ;
2882
2882
self . res_to_ty ( opt_self_ty, path, false )
2883
2883
}
2884
2884
hir:: TyKind :: OpaqueDef ( item_id, lifetimes, in_trait) => {
2885
- let opaque_ty = tcx. hir ( ) . item ( item_id) ;
2885
+ let opaque_ty = tcx. hir ( ) . item ( * item_id) ;
2886
2886
let def_id = item_id. owner_id . to_def_id ( ) ;
2887
2887
2888
2888
match opaque_ty. kind {
2889
2889
hir:: ItemKind :: OpaqueTy ( hir:: OpaqueTy { origin, .. } ) => {
2890
- self . impl_trait_ty_to_ty ( def_id, lifetimes, origin, in_trait)
2890
+ self . impl_trait_ty_to_ty ( def_id, lifetimes, origin, * in_trait)
2891
2891
}
2892
2892
ref i => bug ! ( "`impl Trait` pointed to non-opaque type?? {:#?}" , i) ,
2893
2893
}
2894
2894
}
2895
- hir:: TyKind :: Path ( hir:: QPath :: TypeRelative ( ref qself, ref segment) ) => {
2895
+ hir:: TyKind :: Path ( hir:: QPath :: TypeRelative ( qself, segment) ) => {
2896
2896
debug ! ( ?qself, ?segment) ;
2897
2897
let ty = self . ast_ty_to_ty_inner ( qself, false , true ) ;
2898
2898
self . associated_path_to_ty ( ast_ty. hir_id , ast_ty. span , ty, qself, segment, false )
2899
2899
. map ( |( ty, _, _) | ty)
2900
2900
. unwrap_or_else ( |_| tcx. ty_error ( ) )
2901
2901
}
2902
- hir:: TyKind :: Path ( hir:: QPath :: LangItem ( lang_item, span, _) ) => {
2902
+ & hir:: TyKind :: Path ( hir:: QPath :: LangItem ( lang_item, span, _) ) => {
2903
2903
let def_id = tcx. require_lang_item ( lang_item, Some ( span) ) ;
2904
2904
let ( substs, _) = self . create_substs_for_ast_path (
2905
2905
span,
@@ -2913,7 +2913,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
2913
2913
) ;
2914
2914
EarlyBinder ( tcx. at ( span) . type_of ( def_id) ) . subst ( tcx, substs)
2915
2915
}
2916
- hir:: TyKind :: Array ( ref ty, ref length) => {
2916
+ hir:: TyKind :: Array ( ty, length) => {
2917
2917
let length = match length {
2918
2918
& hir:: ArrayLen :: Infer ( _, span) => self . ct_infer ( tcx. types . usize , None , span) ,
2919
2919
hir:: ArrayLen :: Body ( constant) => {
@@ -2923,7 +2923,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
2923
2923
2924
2924
tcx. mk_ty ( ty:: Array ( self . ast_ty_to_ty ( ty) , length) )
2925
2925
}
2926
- hir:: TyKind :: Typeof ( ref e) => {
2926
+ hir:: TyKind :: Typeof ( e) => {
2927
2927
let ty_erased = tcx. type_of ( e. def_id ) ;
2928
2928
let ty = tcx. fold_regions ( ty_erased, |r, _| {
2929
2929
if r. is_erased ( ) { tcx. lifetimes . re_static } else { r }
0 commit comments