@@ -248,7 +248,7 @@ impl Clean<Option<WherePredicate>> for hir::WherePredicate<'_> {
248248 hir:: WherePredicate :: BoundPredicate ( ref wbp) => {
249249 let bound_params = wbp
250250 . bound_generic_params
251- . into_iter ( )
251+ . iter ( )
252252 . map ( |param| {
253253 // Higher-ranked params must be lifetimes.
254254 // Higher-ranked lifetimes can't have bounds.
@@ -520,7 +520,7 @@ fn clean_generic_param(
520520 } ,
521521 )
522522 }
523- hir:: GenericParamKind :: Const { ref ty, default } => (
523+ hir:: GenericParamKind :: Const { ty, default } => (
524524 param. name . ident ( ) . name ,
525525 GenericParamDefKind :: Const {
526526 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(
942942 // We assume all empty tuples are default return type. This theoretically can discard `-> ()`,
943943 // but shouldn't change any code meaning.
944944 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 ,
946946 ty => Return ( ty) ,
947947 } ;
948948
@@ -967,7 +967,7 @@ fn clean_fn_decl_from_did_and_sig(
967967impl Clean < FnRetTy > for hir:: FnRetTy < ' _ > {
968968 fn clean ( & self , cx : & mut DocContext < ' _ > ) -> FnRetTy {
969969 match * self {
970- Self :: Return ( ref typ) => Return ( typ. clean ( cx) ) ,
970+ Self :: Return ( typ) => Return ( typ. clean ( cx) ) ,
971971 Self :: DefaultReturn ( ..) => DefaultReturn ,
972972 }
973973 }
@@ -1008,13 +1008,13 @@ impl Clean<Item> for hir::TraitItem<'_> {
10081008 let local_did = self . def_id . to_def_id ( ) ;
10091009 cx. with_param_env ( local_did, |cx| {
10101010 let inner = match self . kind {
1011- hir:: TraitItemKind :: Const ( ref ty, Some ( default) ) => AssocConstItem (
1011+ hir:: TraitItemKind :: Const ( ty, Some ( default) ) => AssocConstItem (
10121012 ty. clean ( cx) ,
10131013 ConstantKind :: Local { def_id : local_did, body : default } ,
10141014 ) ,
1015- hir:: TraitItemKind :: Const ( ref ty, None ) => TyAssocConstItem ( ty. clean ( cx) ) ,
1015+ hir:: TraitItemKind :: Const ( ty, None ) => TyAssocConstItem ( ty. clean ( cx) ) ,
10161016 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) ;
10181018 MethodItem ( m, None )
10191019 }
10201020 hir:: TraitItemKind :: Fn ( ref sig, hir:: TraitFn :: Required ( names) ) => {
@@ -1055,16 +1055,16 @@ impl Clean<Item> for hir::ImplItem<'_> {
10551055 let local_did = self . def_id . to_def_id ( ) ;
10561056 cx. with_param_env ( local_did, |cx| {
10571057 let inner = match self . kind {
1058- hir:: ImplItemKind :: Const ( ref ty, expr) => {
1058+ hir:: ImplItemKind :: Const ( ty, expr) => {
10591059 let default = ConstantKind :: Local { def_id : local_did, body : expr } ;
10601060 AssocConstItem ( ty. clean ( cx) , default)
10611061 }
10621062 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) ;
10641064 let defaultness = cx. tcx . associated_item ( self . def_id ) . defaultness ;
10651065 MethodItem ( m, Some ( defaultness) )
10661066 }
1067- hir:: ImplItemKind :: TyAlias ( ref hir_ty) => {
1067+ hir:: ImplItemKind :: TyAlias ( hir_ty) => {
10681068 let type_ = hir_ty. clean ( cx) ;
10691069 let generics = self . generics . clean ( cx) ;
10701070 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 {
12871287 let hir:: TyKind :: Path ( qpath) = kind else { unreachable ! ( ) } ;
12881288
12891289 match qpath {
1290- hir:: QPath :: Resolved ( None , ref path) => {
1290+ hir:: QPath :: Resolved ( None , path) => {
12911291 if let Res :: Def ( DefKind :: TyParam , did) = path. res {
12921292 if let Some ( new_ty) = cx. substs . get ( & did) . and_then ( |p| p. as_ty ( ) ) . cloned ( ) {
12931293 return new_ty;
@@ -1304,7 +1304,7 @@ fn clean_qpath(hir_ty: &hir::Ty<'_>, cx: &mut DocContext<'_>) -> Type {
13041304 resolve_type ( cx, path)
13051305 }
13061306 }
1307- hir:: QPath :: Resolved ( Some ( ref qself) , p) => {
1307+ hir:: QPath :: Resolved ( Some ( qself) , p) => {
13081308 // Try to normalize `<X as Y>::T` to a type
13091309 let ty = hir_ty_to_ty ( cx. tcx , hir_ty) ;
13101310 if let Some ( normalized_value) = normalize ( cx, ty) {
@@ -1328,7 +1328,7 @@ fn clean_qpath(hir_ty: &hir::Ty<'_>, cx: &mut DocContext<'_>) -> Type {
13281328 trait_,
13291329 }
13301330 }
1331- hir:: QPath :: TypeRelative ( ref qself, segment) => {
1331+ hir:: QPath :: TypeRelative ( qself, segment) => {
13321332 let ty = hir_ty_to_ty ( cx. tcx , hir_ty) ;
13331333 let res = match ty. kind ( ) {
13341334 ty:: Projection ( proj) => Res :: Def ( DefKind :: Trait , proj. trait_ref ( cx. tcx ) . def_id ) ,
@@ -1455,8 +1455,8 @@ impl Clean<Type> for hir::Ty<'_> {
14551455 let lifetime = if elided { None } else { Some ( l. clean ( cx) ) } ;
14561456 BorrowedRef { lifetime, mutability : m. mutbl , type_ : box m. ty . clean ( cx) }
14571457 }
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) => {
14601460 let length = match length {
14611461 hir:: ArrayLen :: Infer ( _, _) => "_" . to_string ( ) ,
14621462 hir:: ArrayLen :: Body ( anon_const) => {
@@ -1491,7 +1491,7 @@ impl Clean<Type> for hir::Ty<'_> {
14911491 let lifetime = if !lifetime. is_elided ( ) { Some ( lifetime. clean ( cx) ) } else { None } ;
14921492 DynTrait ( bounds, lifetime)
14931493 }
1494- TyKind :: BareFn ( ref barefn) => BareFunction ( box barefn. clean ( cx) ) ,
1494+ TyKind :: BareFn ( barefn) => BareFunction ( box barefn. clean ( cx) ) ,
14951495 // Rustdoc handles `TyKind::Err`s by turning them into `Type::Infer`s.
14961496 TyKind :: Infer | TyKind :: Err => Infer ,
14971497 TyKind :: Typeof ( ..) => panic ! ( "unimplemented type {:?}" , self . kind) ,
@@ -1900,7 +1900,7 @@ fn clean_maybe_renamed_item(
19001900 bounds : ty. bounds . iter ( ) . filter_map ( |x| x. clean ( cx) ) . collect ( ) ,
19011901 generics : ty. generics . clean ( cx) ,
19021902 } ) ,
1903- ItemKind :: TyAlias ( hir_ty, ref generics) => {
1903+ ItemKind :: TyAlias ( hir_ty, generics) => {
19041904 let rustdoc_ty = hir_ty. clean ( cx) ;
19051905 let ty = hir_ty_to_ty ( cx. tcx , hir_ty) . clean ( cx) ;
19061906 TypedefItem ( Typedef {
@@ -1909,26 +1909,26 @@ fn clean_maybe_renamed_item(
19091909 item_type : Some ( ty) ,
19101910 } )
19111911 }
1912- ItemKind :: Enum ( ref def, ref generics) => EnumItem ( Enum {
1912+ ItemKind :: Enum ( ref def, generics) => EnumItem ( Enum {
19131913 variants : def. variants . iter ( ) . map ( |v| v. clean ( cx) ) . collect ( ) ,
19141914 generics : generics. clean ( cx) ,
19151915 } ) ,
1916- ItemKind :: TraitAlias ( ref generics, bounds) => TraitAliasItem ( TraitAlias {
1916+ ItemKind :: TraitAlias ( generics, bounds) => TraitAliasItem ( TraitAlias {
19171917 generics : generics. clean ( cx) ,
19181918 bounds : bounds. iter ( ) . filter_map ( |x| x. clean ( cx) ) . collect ( ) ,
19191919 } ) ,
1920- ItemKind :: Union ( ref variant_data, ref generics) => UnionItem ( Union {
1920+ ItemKind :: Union ( ref variant_data, generics) => UnionItem ( Union {
19211921 generics : generics. clean ( cx) ,
19221922 fields : variant_data. fields ( ) . iter ( ) . map ( |x| x. clean ( cx) ) . collect ( ) ,
19231923 } ) ,
1924- ItemKind :: Struct ( ref variant_data, ref generics) => StructItem ( Struct {
1924+ ItemKind :: Struct ( ref variant_data, generics) => StructItem ( Struct {
19251925 struct_type : CtorKind :: from_hir ( variant_data) ,
19261926 generics : generics. clean ( cx) ,
19271927 fields : variant_data. fields ( ) . iter ( ) . map ( |x| x. clean ( cx) ) . collect ( ) ,
19281928 } ) ,
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) ,
19301930 // 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) => {
19321932 clean_fn_or_proc_macro ( item, sig, generics, body_id, & mut name, cx)
19331933 }
19341934 ItemKind :: Macro ( ref macro_def, _) => {
@@ -1937,7 +1937,7 @@ fn clean_maybe_renamed_item(
19371937 source : display_macro_source ( cx, name, macro_def, def_id, ty_vis) ,
19381938 } )
19391939 }
1940- ItemKind :: Trait ( is_auto, unsafety, ref generics, bounds, item_ids) => {
1940+ ItemKind :: Trait ( is_auto, unsafety, generics, bounds, item_ids) => {
19411941 let items =
19421942 item_ids. iter ( ) . map ( |ti| cx. tcx . hir ( ) . trait_item ( ti. id ) . clean ( cx) ) . collect ( ) ;
19431943 TraitItem ( Trait {
@@ -2180,7 +2180,7 @@ fn clean_maybe_renamed_foreign_item(
21802180 let def_id = item. def_id . to_def_id ( ) ;
21812181 cx. with_param_env ( def_id, |cx| {
21822182 let kind = match item. kind {
2183- hir:: ForeignItemKind :: Fn ( decl, names, ref generics) => {
2183+ hir:: ForeignItemKind :: Fn ( decl, names, generics) => {
21842184 let ( generics, decl) = enter_impl_trait ( cx, |cx| {
21852185 // NOTE: generics must be cleaned before args
21862186 let generics = generics. clean ( cx) ;
@@ -2190,7 +2190,7 @@ fn clean_maybe_renamed_foreign_item(
21902190 } ) ;
21912191 ForeignFunctionItem ( Function { decl, generics } )
21922192 }
2193- hir:: ForeignItemKind :: Static ( ref ty, mutability) => {
2193+ hir:: ForeignItemKind :: Static ( ty, mutability) => {
21942194 ForeignStaticItem ( Static { type_ : ty. clean ( cx) , mutability, expr : None } )
21952195 }
21962196 hir:: ForeignItemKind :: Type => ForeignTypeItem ,
@@ -2220,7 +2220,7 @@ impl Clean<TypeBindingKind> for hir::TypeBindingKind<'_> {
22202220 hir:: TypeBindingKind :: Equality { ref term } => {
22212221 TypeBindingKind :: Equality { term : term. clean ( cx) }
22222222 }
2223- hir:: TypeBindingKind :: Constraint { ref bounds } => TypeBindingKind :: Constraint {
2223+ hir:: TypeBindingKind :: Constraint { bounds } => TypeBindingKind :: Constraint {
22242224 bounds : bounds. iter ( ) . filter_map ( |b| b. clean ( cx) ) . collect ( ) ,
22252225 } ,
22262226 }
0 commit comments