@@ -248,7 +248,7 @@ impl Clean<Option<WherePredicate>> for hir::WherePredicate<'_> {
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.
@@ -520,7 +520,7 @@ fn clean_generic_param(
520
520
} ,
521
521
)
522
522
}
523
- hir:: GenericParamKind :: Const { ref ty, default } => (
523
+ hir:: GenericParamKind :: Const { ty, default } => (
524
524
param. name . ident ( ) . name ,
525
525
GenericParamDefKind :: Const {
526
526
did : cx. tcx . hir ( ) . local_def_id ( param. hir_id ) . to_def_id ( ) ,
@@ -942,7 +942,7 @@ fn clean_fn_decl_from_did_and_sig(
942
942
// We assume all empty tuples are default return type. This theoretically can discard `-> ()`,
943
943
// but shouldn't change any code meaning.
944
944
let output = match sig. skip_binder ( ) . output ( ) . clean ( cx) {
945
- Type :: Tuple ( inner) if inner. len ( ) == 0 => DefaultReturn ,
945
+ Type :: Tuple ( inner) if inner. is_empty ( ) => DefaultReturn ,
946
946
ty => Return ( ty) ,
947
947
} ;
948
948
@@ -967,7 +967,7 @@ fn clean_fn_decl_from_did_and_sig(
967
967
impl Clean < FnRetTy > for hir:: FnRetTy < ' _ > {
968
968
fn clean ( & self , cx : & mut DocContext < ' _ > ) -> FnRetTy {
969
969
match * self {
970
- Self :: Return ( ref typ) => Return ( typ. clean ( cx) ) ,
970
+ Self :: Return ( typ) => Return ( typ. clean ( cx) ) ,
971
971
Self :: DefaultReturn ( ..) => DefaultReturn ,
972
972
}
973
973
}
@@ -1008,13 +1008,13 @@ impl Clean<Item> for hir::TraitItem<'_> {
1008
1008
let local_did = self . def_id . to_def_id ( ) ;
1009
1009
cx. with_param_env ( local_did, |cx| {
1010
1010
let inner = match self . kind {
1011
- hir:: TraitItemKind :: Const ( ref ty, Some ( default) ) => AssocConstItem (
1011
+ hir:: TraitItemKind :: Const ( ty, Some ( default) ) => AssocConstItem (
1012
1012
ty. clean ( cx) ,
1013
1013
ConstantKind :: Local { def_id : local_did, body : default } ,
1014
1014
) ,
1015
- hir:: TraitItemKind :: Const ( ref ty, None ) => TyAssocConstItem ( ty. clean ( cx) ) ,
1015
+ hir:: TraitItemKind :: Const ( ty, None ) => TyAssocConstItem ( ty. clean ( cx) ) ,
1016
1016
hir:: TraitItemKind :: Fn ( ref sig, hir:: TraitFn :: Provided ( body) ) => {
1017
- let m = clean_function ( cx, sig, & self . generics , body) ;
1017
+ let m = clean_function ( cx, sig, self . generics , body) ;
1018
1018
MethodItem ( m, None )
1019
1019
}
1020
1020
hir:: TraitItemKind :: Fn ( ref sig, hir:: TraitFn :: Required ( names) ) => {
@@ -1055,16 +1055,16 @@ impl Clean<Item> for hir::ImplItem<'_> {
1055
1055
let local_did = self . def_id . to_def_id ( ) ;
1056
1056
cx. with_param_env ( local_did, |cx| {
1057
1057
let inner = match self . kind {
1058
- hir:: ImplItemKind :: Const ( ref ty, expr) => {
1058
+ hir:: ImplItemKind :: Const ( ty, expr) => {
1059
1059
let default = ConstantKind :: Local { def_id : local_did, body : expr } ;
1060
1060
AssocConstItem ( ty. clean ( cx) , default)
1061
1061
}
1062
1062
hir:: ImplItemKind :: Fn ( ref sig, body) => {
1063
- let m = clean_function ( cx, sig, & self . generics , body) ;
1063
+ let m = clean_function ( cx, sig, self . generics , body) ;
1064
1064
let defaultness = cx. tcx . associated_item ( self . def_id ) . defaultness ;
1065
1065
MethodItem ( m, Some ( defaultness) )
1066
1066
}
1067
- hir:: ImplItemKind :: TyAlias ( ref hir_ty) => {
1067
+ hir:: ImplItemKind :: TyAlias ( hir_ty) => {
1068
1068
let type_ = hir_ty. clean ( cx) ;
1069
1069
let generics = self . generics . clean ( cx) ;
1070
1070
let item_type = hir_ty_to_ty ( cx. tcx , hir_ty) . clean ( cx) ;
@@ -1287,7 +1287,7 @@ fn clean_qpath(hir_ty: &hir::Ty<'_>, cx: &mut DocContext<'_>) -> Type {
1287
1287
let hir:: TyKind :: Path ( qpath) = kind else { unreachable ! ( ) } ;
1288
1288
1289
1289
match qpath {
1290
- hir:: QPath :: Resolved ( None , ref path) => {
1290
+ hir:: QPath :: Resolved ( None , path) => {
1291
1291
if let Res :: Def ( DefKind :: TyParam , did) = path. res {
1292
1292
if let Some ( new_ty) = cx. substs . get ( & did) . and_then ( |p| p. as_ty ( ) ) . cloned ( ) {
1293
1293
return new_ty;
@@ -1304,7 +1304,7 @@ fn clean_qpath(hir_ty: &hir::Ty<'_>, cx: &mut DocContext<'_>) -> Type {
1304
1304
resolve_type ( cx, path)
1305
1305
}
1306
1306
}
1307
- hir:: QPath :: Resolved ( Some ( ref qself) , p) => {
1307
+ hir:: QPath :: Resolved ( Some ( qself) , p) => {
1308
1308
// Try to normalize `<X as Y>::T` to a type
1309
1309
let ty = hir_ty_to_ty ( cx. tcx , hir_ty) ;
1310
1310
if let Some ( normalized_value) = normalize ( cx, ty) {
@@ -1328,7 +1328,7 @@ fn clean_qpath(hir_ty: &hir::Ty<'_>, cx: &mut DocContext<'_>) -> Type {
1328
1328
trait_,
1329
1329
}
1330
1330
}
1331
- hir:: QPath :: TypeRelative ( ref qself, segment) => {
1331
+ hir:: QPath :: TypeRelative ( qself, segment) => {
1332
1332
let ty = hir_ty_to_ty ( cx. tcx , hir_ty) ;
1333
1333
let res = match ty. kind ( ) {
1334
1334
ty:: Projection ( proj) => Res :: Def ( DefKind :: Trait , proj. trait_ref ( cx. tcx ) . def_id ) ,
@@ -1455,8 +1455,8 @@ impl Clean<Type> for hir::Ty<'_> {
1455
1455
let lifetime = if elided { None } else { Some ( l. clean ( cx) ) } ;
1456
1456
BorrowedRef { lifetime, mutability : m. mutbl , type_ : box m. ty . clean ( cx) }
1457
1457
}
1458
- TyKind :: Slice ( ref ty) => Slice ( box ty. clean ( cx) ) ,
1459
- TyKind :: Array ( ref ty, ref length) => {
1458
+ TyKind :: Slice ( ty) => Slice ( box ty. clean ( cx) ) ,
1459
+ TyKind :: Array ( ty, ref length) => {
1460
1460
let length = match length {
1461
1461
hir:: ArrayLen :: Infer ( _, _) => "_" . to_string ( ) ,
1462
1462
hir:: ArrayLen :: Body ( anon_const) => {
@@ -1491,7 +1491,7 @@ impl Clean<Type> for hir::Ty<'_> {
1491
1491
let lifetime = if !lifetime. is_elided ( ) { Some ( lifetime. clean ( cx) ) } else { None } ;
1492
1492
DynTrait ( bounds, lifetime)
1493
1493
}
1494
- TyKind :: BareFn ( ref barefn) => BareFunction ( box barefn. clean ( cx) ) ,
1494
+ TyKind :: BareFn ( barefn) => BareFunction ( box barefn. clean ( cx) ) ,
1495
1495
// Rustdoc handles `TyKind::Err`s by turning them into `Type::Infer`s.
1496
1496
TyKind :: Infer | TyKind :: Err => Infer ,
1497
1497
TyKind :: Typeof ( ..) => panic ! ( "unimplemented type {:?}" , self . kind) ,
@@ -1900,7 +1900,7 @@ fn clean_maybe_renamed_item(
1900
1900
bounds : ty. bounds . iter ( ) . filter_map ( |x| x. clean ( cx) ) . collect ( ) ,
1901
1901
generics : ty. generics . clean ( cx) ,
1902
1902
} ) ,
1903
- ItemKind :: TyAlias ( hir_ty, ref generics) => {
1903
+ ItemKind :: TyAlias ( hir_ty, generics) => {
1904
1904
let rustdoc_ty = hir_ty. clean ( cx) ;
1905
1905
let ty = hir_ty_to_ty ( cx. tcx , hir_ty) . clean ( cx) ;
1906
1906
TypedefItem ( Typedef {
@@ -1909,26 +1909,26 @@ fn clean_maybe_renamed_item(
1909
1909
item_type : Some ( ty) ,
1910
1910
} )
1911
1911
}
1912
- ItemKind :: Enum ( ref def, ref generics) => EnumItem ( Enum {
1912
+ ItemKind :: Enum ( ref def, generics) => EnumItem ( Enum {
1913
1913
variants : def. variants . iter ( ) . map ( |v| v. clean ( cx) ) . collect ( ) ,
1914
1914
generics : generics. clean ( cx) ,
1915
1915
} ) ,
1916
- ItemKind :: TraitAlias ( ref generics, bounds) => TraitAliasItem ( TraitAlias {
1916
+ ItemKind :: TraitAlias ( generics, bounds) => TraitAliasItem ( TraitAlias {
1917
1917
generics : generics. clean ( cx) ,
1918
1918
bounds : bounds. iter ( ) . filter_map ( |x| x. clean ( cx) ) . collect ( ) ,
1919
1919
} ) ,
1920
- ItemKind :: Union ( ref variant_data, ref generics) => UnionItem ( Union {
1920
+ ItemKind :: Union ( ref variant_data, generics) => UnionItem ( Union {
1921
1921
generics : generics. clean ( cx) ,
1922
1922
fields : variant_data. fields ( ) . iter ( ) . map ( |x| x. clean ( cx) ) . collect ( ) ,
1923
1923
} ) ,
1924
- ItemKind :: Struct ( ref variant_data, ref generics) => StructItem ( Struct {
1924
+ ItemKind :: Struct ( ref variant_data, generics) => StructItem ( Struct {
1925
1925
struct_type : CtorKind :: from_hir ( variant_data) ,
1926
1926
generics : generics. clean ( cx) ,
1927
1927
fields : variant_data. fields ( ) . iter ( ) . map ( |x| x. clean ( cx) ) . collect ( ) ,
1928
1928
} ) ,
1929
- ItemKind :: Impl ( ref impl_) => return clean_impl ( impl_, item. hir_id ( ) , cx) ,
1929
+ ItemKind :: Impl ( impl_) => return clean_impl ( impl_, item. hir_id ( ) , cx) ,
1930
1930
// proc macros can have a name set by attributes
1931
- ItemKind :: Fn ( ref sig, ref generics, body_id) => {
1931
+ ItemKind :: Fn ( ref sig, generics, body_id) => {
1932
1932
clean_fn_or_proc_macro ( item, sig, generics, body_id, & mut name, cx)
1933
1933
}
1934
1934
ItemKind :: Macro ( ref macro_def, _) => {
@@ -1937,7 +1937,7 @@ fn clean_maybe_renamed_item(
1937
1937
source : display_macro_source ( cx, name, macro_def, def_id, ty_vis) ,
1938
1938
} )
1939
1939
}
1940
- ItemKind :: Trait ( is_auto, unsafety, ref generics, bounds, item_ids) => {
1940
+ ItemKind :: Trait ( is_auto, unsafety, generics, bounds, item_ids) => {
1941
1941
let items =
1942
1942
item_ids. iter ( ) . map ( |ti| cx. tcx . hir ( ) . trait_item ( ti. id ) . clean ( cx) ) . collect ( ) ;
1943
1943
TraitItem ( Trait {
@@ -2180,7 +2180,7 @@ fn clean_maybe_renamed_foreign_item(
2180
2180
let def_id = item. def_id . to_def_id ( ) ;
2181
2181
cx. with_param_env ( def_id, |cx| {
2182
2182
let kind = match item. kind {
2183
- hir:: ForeignItemKind :: Fn ( decl, names, ref generics) => {
2183
+ hir:: ForeignItemKind :: Fn ( decl, names, generics) => {
2184
2184
let ( generics, decl) = enter_impl_trait ( cx, |cx| {
2185
2185
// NOTE: generics must be cleaned before args
2186
2186
let generics = generics. clean ( cx) ;
@@ -2190,7 +2190,7 @@ fn clean_maybe_renamed_foreign_item(
2190
2190
} ) ;
2191
2191
ForeignFunctionItem ( Function { decl, generics } )
2192
2192
}
2193
- hir:: ForeignItemKind :: Static ( ref ty, mutability) => {
2193
+ hir:: ForeignItemKind :: Static ( ty, mutability) => {
2194
2194
ForeignStaticItem ( Static { type_ : ty. clean ( cx) , mutability, expr : None } )
2195
2195
}
2196
2196
hir:: ForeignItemKind :: Type => ForeignTypeItem ,
@@ -2220,7 +2220,7 @@ impl Clean<TypeBindingKind> for hir::TypeBindingKind<'_> {
2220
2220
hir:: TypeBindingKind :: Equality { ref term } => {
2221
2221
TypeBindingKind :: Equality { term : term. clean ( cx) }
2222
2222
}
2223
- hir:: TypeBindingKind :: Constraint { ref bounds } => TypeBindingKind :: Constraint {
2223
+ hir:: TypeBindingKind :: Constraint { bounds } => TypeBindingKind :: Constraint {
2224
2224
bounds : bounds. iter ( ) . filter_map ( |b| b. clean ( cx) ) . collect ( ) ,
2225
2225
} ,
2226
2226
}
0 commit comments