@@ -248,7 +248,7 @@ impl<'tcx> Clean<'tcx, Option<WherePredicate>> for hir::WherePredicate<'tcx> {
248
248
hir:: WherePredicate :: BoundPredicate ( ref wbp) => {
249
249
let bound_params = wbp
250
250
. bound_generic_params
251
- . into_iter ( )
251
+ . iter ( )
252
252
. map ( |param| {
253
253
// Higher-ranked params must be lifetimes.
254
254
// Higher-ranked lifetimes can't have bounds.
@@ -525,7 +525,7 @@ fn clean_generic_param<'tcx>(
525
525
} ,
526
526
)
527
527
}
528
- hir:: GenericParamKind :: Const { ref ty, default } => (
528
+ hir:: GenericParamKind :: Const { ty, default } => (
529
529
param. name . ident ( ) . name ,
530
530
GenericParamDefKind :: Const {
531
531
did : cx. tcx . hir ( ) . local_def_id ( param. hir_id ) . to_def_id ( ) ,
@@ -947,7 +947,7 @@ fn clean_fn_decl_from_did_and_sig<'tcx>(
947
947
// We assume all empty tuples are default return type. This theoretically can discard `-> ()`,
948
948
// but shouldn't change any code meaning.
949
949
let output = match sig. skip_binder ( ) . output ( ) . clean ( cx) {
950
- Type :: Tuple ( inner) if inner. len ( ) == 0 => DefaultReturn ,
950
+ Type :: Tuple ( inner) if inner. is_empty ( ) => DefaultReturn ,
951
951
ty => Return ( ty) ,
952
952
} ;
953
953
@@ -972,7 +972,7 @@ fn clean_fn_decl_from_did_and_sig<'tcx>(
972
972
impl < ' tcx > Clean < ' tcx , FnRetTy > for hir:: FnRetTy < ' tcx > {
973
973
fn clean ( & self , cx : & mut DocContext < ' tcx > ) -> FnRetTy {
974
974
match * self {
975
- Self :: Return ( ref typ) => Return ( typ. clean ( cx) ) ,
975
+ Self :: Return ( typ) => Return ( typ. clean ( cx) ) ,
976
976
Self :: DefaultReturn ( ..) => DefaultReturn ,
977
977
}
978
978
}
@@ -1013,13 +1013,13 @@ impl<'tcx> Clean<'tcx, Item> for hir::TraitItem<'tcx> {
1013
1013
let local_did = self . def_id . to_def_id ( ) ;
1014
1014
cx. with_param_env ( local_did, |cx| {
1015
1015
let inner = match self . kind {
1016
- hir:: TraitItemKind :: Const ( ref ty, Some ( default) ) => AssocConstItem (
1016
+ hir:: TraitItemKind :: Const ( ty, Some ( default) ) => AssocConstItem (
1017
1017
ty. clean ( cx) ,
1018
1018
ConstantKind :: Local { def_id : local_did, body : default } ,
1019
1019
) ,
1020
- hir:: TraitItemKind :: Const ( ref ty, None ) => TyAssocConstItem ( ty. clean ( cx) ) ,
1020
+ hir:: TraitItemKind :: Const ( ty, None ) => TyAssocConstItem ( ty. clean ( cx) ) ,
1021
1021
hir:: TraitItemKind :: Fn ( ref sig, hir:: TraitFn :: Provided ( body) ) => {
1022
- let m = clean_function ( cx, sig, & self . generics , body) ;
1022
+ let m = clean_function ( cx, sig, self . generics , body) ;
1023
1023
MethodItem ( m, None )
1024
1024
}
1025
1025
hir:: TraitItemKind :: Fn ( ref sig, hir:: TraitFn :: Required ( names) ) => {
@@ -1060,16 +1060,16 @@ impl<'tcx> Clean<'tcx, Item> for hir::ImplItem<'tcx> {
1060
1060
let local_did = self . def_id . to_def_id ( ) ;
1061
1061
cx. with_param_env ( local_did, |cx| {
1062
1062
let inner = match self . kind {
1063
- hir:: ImplItemKind :: Const ( ref ty, expr) => {
1063
+ hir:: ImplItemKind :: Const ( ty, expr) => {
1064
1064
let default = ConstantKind :: Local { def_id : local_did, body : expr } ;
1065
1065
AssocConstItem ( ty. clean ( cx) , default)
1066
1066
}
1067
1067
hir:: ImplItemKind :: Fn ( ref sig, body) => {
1068
- let m = clean_function ( cx, sig, & self . generics , body) ;
1068
+ let m = clean_function ( cx, sig, self . generics , body) ;
1069
1069
let defaultness = cx. tcx . associated_item ( self . def_id ) . defaultness ;
1070
1070
MethodItem ( m, Some ( defaultness) )
1071
1071
}
1072
- hir:: ImplItemKind :: TyAlias ( ref hir_ty) => {
1072
+ hir:: ImplItemKind :: TyAlias ( hir_ty) => {
1073
1073
let type_ = hir_ty. clean ( cx) ;
1074
1074
let generics = self . generics . clean ( cx) ;
1075
1075
let item_type = hir_ty_to_ty ( cx. tcx , hir_ty) . clean ( cx) ;
@@ -1292,7 +1292,7 @@ fn clean_qpath<'tcx>(hir_ty: &hir::Ty<'tcx>, cx: &mut DocContext<'tcx>) -> Type
1292
1292
let hir:: TyKind :: Path ( qpath) = kind else { unreachable ! ( ) } ;
1293
1293
1294
1294
match qpath {
1295
- hir:: QPath :: Resolved ( None , ref path) => {
1295
+ hir:: QPath :: Resolved ( None , path) => {
1296
1296
if let Res :: Def ( DefKind :: TyParam , did) = path. res {
1297
1297
if let Some ( new_ty) = cx. substs . get ( & did) . and_then ( |p| p. as_ty ( ) ) . cloned ( ) {
1298
1298
return new_ty;
@@ -1309,7 +1309,7 @@ fn clean_qpath<'tcx>(hir_ty: &hir::Ty<'tcx>, cx: &mut DocContext<'tcx>) -> Type
1309
1309
resolve_type ( cx, path)
1310
1310
}
1311
1311
}
1312
- hir:: QPath :: Resolved ( Some ( ref qself) , p) => {
1312
+ hir:: QPath :: Resolved ( Some ( qself) , p) => {
1313
1313
// Try to normalize `<X as Y>::T` to a type
1314
1314
let ty = hir_ty_to_ty ( cx. tcx , hir_ty) ;
1315
1315
if let Some ( normalized_value) = normalize ( cx, ty) {
@@ -1333,7 +1333,7 @@ fn clean_qpath<'tcx>(hir_ty: &hir::Ty<'tcx>, cx: &mut DocContext<'tcx>) -> Type
1333
1333
trait_,
1334
1334
}
1335
1335
}
1336
- hir:: QPath :: TypeRelative ( ref qself, segment) => {
1336
+ hir:: QPath :: TypeRelative ( qself, segment) => {
1337
1337
let ty = hir_ty_to_ty ( cx. tcx , hir_ty) ;
1338
1338
let res = match ty. kind ( ) {
1339
1339
ty:: Projection ( proj) => Res :: Def ( DefKind :: Trait , proj. trait_ref ( cx. tcx ) . def_id ) ,
@@ -1463,8 +1463,8 @@ impl<'tcx> Clean<'tcx, Type> for hir::Ty<'tcx> {
1463
1463
let lifetime = if elided { None } else { Some ( l. clean ( cx) ) } ;
1464
1464
BorrowedRef { lifetime, mutability : m. mutbl , type_ : box m. ty . clean ( cx) }
1465
1465
}
1466
- TyKind :: Slice ( ref ty) => Slice ( box ty. clean ( cx) ) ,
1467
- TyKind :: Array ( ref ty, ref length) => {
1466
+ TyKind :: Slice ( ty) => Slice ( box ty. clean ( cx) ) ,
1467
+ TyKind :: Array ( ty, ref length) => {
1468
1468
let length = match length {
1469
1469
hir:: ArrayLen :: Infer ( _, _) => "_" . to_string ( ) ,
1470
1470
hir:: ArrayLen :: Body ( anon_const) => {
@@ -1499,7 +1499,7 @@ impl<'tcx> Clean<'tcx, Type> for hir::Ty<'tcx> {
1499
1499
let lifetime = if !lifetime. is_elided ( ) { Some ( lifetime. clean ( cx) ) } else { None } ;
1500
1500
DynTrait ( bounds, lifetime)
1501
1501
}
1502
- TyKind :: BareFn ( ref barefn) => BareFunction ( box barefn. clean ( cx) ) ,
1502
+ TyKind :: BareFn ( barefn) => BareFunction ( box barefn. clean ( cx) ) ,
1503
1503
// Rustdoc handles `TyKind::Err`s by turning them into `Type::Infer`s.
1504
1504
TyKind :: Infer | TyKind :: Err => Infer ,
1505
1505
TyKind :: Typeof ( ..) => panic ! ( "unimplemented type {:?}" , self . kind) ,
@@ -1908,7 +1908,7 @@ fn clean_maybe_renamed_item<'tcx>(
1908
1908
bounds : ty. bounds . iter ( ) . filter_map ( |x| x. clean ( cx) ) . collect ( ) ,
1909
1909
generics : ty. generics . clean ( cx) ,
1910
1910
} ) ,
1911
- ItemKind :: TyAlias ( hir_ty, ref generics) => {
1911
+ ItemKind :: TyAlias ( hir_ty, generics) => {
1912
1912
let rustdoc_ty = hir_ty. clean ( cx) ;
1913
1913
let ty = hir_ty_to_ty ( cx. tcx , hir_ty) . clean ( cx) ;
1914
1914
TypedefItem ( Typedef {
@@ -1917,26 +1917,26 @@ fn clean_maybe_renamed_item<'tcx>(
1917
1917
item_type : Some ( ty) ,
1918
1918
} )
1919
1919
}
1920
- ItemKind :: Enum ( ref def, ref generics) => EnumItem ( Enum {
1920
+ ItemKind :: Enum ( ref def, generics) => EnumItem ( Enum {
1921
1921
variants : def. variants . iter ( ) . map ( |v| v. clean ( cx) ) . collect ( ) ,
1922
1922
generics : generics. clean ( cx) ,
1923
1923
} ) ,
1924
- ItemKind :: TraitAlias ( ref generics, bounds) => TraitAliasItem ( TraitAlias {
1924
+ ItemKind :: TraitAlias ( generics, bounds) => TraitAliasItem ( TraitAlias {
1925
1925
generics : generics. clean ( cx) ,
1926
1926
bounds : bounds. iter ( ) . filter_map ( |x| x. clean ( cx) ) . collect ( ) ,
1927
1927
} ) ,
1928
- ItemKind :: Union ( ref variant_data, ref generics) => UnionItem ( Union {
1928
+ ItemKind :: Union ( ref variant_data, generics) => UnionItem ( Union {
1929
1929
generics : generics. clean ( cx) ,
1930
1930
fields : variant_data. fields ( ) . iter ( ) . map ( |x| x. clean ( cx) ) . collect ( ) ,
1931
1931
} ) ,
1932
- ItemKind :: Struct ( ref variant_data, ref generics) => StructItem ( Struct {
1932
+ ItemKind :: Struct ( ref variant_data, generics) => StructItem ( Struct {
1933
1933
struct_type : CtorKind :: from_hir ( variant_data) ,
1934
1934
generics : generics. clean ( cx) ,
1935
1935
fields : variant_data. fields ( ) . iter ( ) . map ( |x| x. clean ( cx) ) . collect ( ) ,
1936
1936
} ) ,
1937
- ItemKind :: Impl ( ref impl_) => return clean_impl ( impl_, item. hir_id ( ) , cx) ,
1937
+ ItemKind :: Impl ( impl_) => return clean_impl ( impl_, item. hir_id ( ) , cx) ,
1938
1938
// proc macros can have a name set by attributes
1939
- ItemKind :: Fn ( ref sig, ref generics, body_id) => {
1939
+ ItemKind :: Fn ( ref sig, generics, body_id) => {
1940
1940
clean_fn_or_proc_macro ( item, sig, generics, body_id, & mut name, cx)
1941
1941
}
1942
1942
ItemKind :: Macro ( ref macro_def, _) => {
@@ -1945,7 +1945,7 @@ fn clean_maybe_renamed_item<'tcx>(
1945
1945
source : display_macro_source ( cx, name, macro_def, def_id, ty_vis) ,
1946
1946
} )
1947
1947
}
1948
- ItemKind :: Trait ( is_auto, unsafety, ref generics, bounds, item_ids) => {
1948
+ ItemKind :: Trait ( is_auto, unsafety, generics, bounds, item_ids) => {
1949
1949
let items =
1950
1950
item_ids. iter ( ) . map ( |ti| cx. tcx . hir ( ) . trait_item ( ti. id ) . clean ( cx) ) . collect ( ) ;
1951
1951
TraitItem ( Trait {
@@ -2192,7 +2192,7 @@ fn clean_maybe_renamed_foreign_item<'tcx>(
2192
2192
let def_id = item. def_id . to_def_id ( ) ;
2193
2193
cx. with_param_env ( def_id, |cx| {
2194
2194
let kind = match item. kind {
2195
- hir:: ForeignItemKind :: Fn ( decl, names, ref generics) => {
2195
+ hir:: ForeignItemKind :: Fn ( decl, names, generics) => {
2196
2196
let ( generics, decl) = enter_impl_trait ( cx, |cx| {
2197
2197
// NOTE: generics must be cleaned before args
2198
2198
let generics = generics. clean ( cx) ;
@@ -2202,7 +2202,7 @@ fn clean_maybe_renamed_foreign_item<'tcx>(
2202
2202
} ) ;
2203
2203
ForeignFunctionItem ( Function { decl, generics } )
2204
2204
}
2205
- hir:: ForeignItemKind :: Static ( ref ty, mutability) => {
2205
+ hir:: ForeignItemKind :: Static ( ty, mutability) => {
2206
2206
ForeignStaticItem ( Static { type_ : ty. clean ( cx) , mutability, expr : None } )
2207
2207
}
2208
2208
hir:: ForeignItemKind :: Type => ForeignTypeItem ,
@@ -2232,7 +2232,7 @@ impl<'tcx> Clean<'tcx, TypeBindingKind> for hir::TypeBindingKind<'tcx> {
2232
2232
hir:: TypeBindingKind :: Equality { ref term } => {
2233
2233
TypeBindingKind :: Equality { term : term. clean ( cx) }
2234
2234
}
2235
- hir:: TypeBindingKind :: Constraint { ref bounds } => TypeBindingKind :: Constraint {
2235
+ hir:: TypeBindingKind :: Constraint { bounds } => TypeBindingKind :: Constraint {
2236
2236
bounds : bounds. iter ( ) . filter_map ( |b| b. clean ( cx) ) . collect ( ) ,
2237
2237
} ,
2238
2238
}
0 commit comments