@@ -248,7 +248,7 @@ impl<'tcx> Clean<'tcx, Option<WherePredicate>> for hir::WherePredicate<'tcx> {
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.
@@ -525,7 +525,7 @@ fn clean_generic_param<'tcx>(
525525 } ,
526526 )
527527 }
528- hir:: GenericParamKind :: Const { ref ty, default } => (
528+ hir:: GenericParamKind :: Const { ty, default } => (
529529 param. name . ident ( ) . name ,
530530 GenericParamDefKind :: Const {
531531 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>(
947947 // We assume all empty tuples are default return type. This theoretically can discard `-> ()`,
948948 // but shouldn't change any code meaning.
949949 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 ,
951951 ty => Return ( ty) ,
952952 } ;
953953
@@ -972,7 +972,7 @@ fn clean_fn_decl_from_did_and_sig<'tcx>(
972972impl < ' tcx > Clean < ' tcx , FnRetTy > for hir:: FnRetTy < ' tcx > {
973973 fn clean ( & self , cx : & mut DocContext < ' tcx > ) -> FnRetTy {
974974 match * self {
975- Self :: Return ( ref typ) => Return ( typ. clean ( cx) ) ,
975+ Self :: Return ( typ) => Return ( typ. clean ( cx) ) ,
976976 Self :: DefaultReturn ( ..) => DefaultReturn ,
977977 }
978978 }
@@ -1013,13 +1013,13 @@ impl<'tcx> Clean<'tcx, Item> for hir::TraitItem<'tcx> {
10131013 let local_did = self . def_id . to_def_id ( ) ;
10141014 cx. with_param_env ( local_did, |cx| {
10151015 let inner = match self . kind {
1016- hir:: TraitItemKind :: Const ( ref ty, Some ( default) ) => AssocConstItem (
1016+ hir:: TraitItemKind :: Const ( ty, Some ( default) ) => AssocConstItem (
10171017 ty. clean ( cx) ,
10181018 ConstantKind :: Local { def_id : local_did, body : default } ,
10191019 ) ,
1020- hir:: TraitItemKind :: Const ( ref ty, None ) => TyAssocConstItem ( ty. clean ( cx) ) ,
1020+ hir:: TraitItemKind :: Const ( ty, None ) => TyAssocConstItem ( ty. clean ( cx) ) ,
10211021 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) ;
10231023 MethodItem ( m, None )
10241024 }
10251025 hir:: TraitItemKind :: Fn ( ref sig, hir:: TraitFn :: Required ( names) ) => {
@@ -1060,16 +1060,16 @@ impl<'tcx> Clean<'tcx, Item> for hir::ImplItem<'tcx> {
10601060 let local_did = self . def_id . to_def_id ( ) ;
10611061 cx. with_param_env ( local_did, |cx| {
10621062 let inner = match self . kind {
1063- hir:: ImplItemKind :: Const ( ref ty, expr) => {
1063+ hir:: ImplItemKind :: Const ( ty, expr) => {
10641064 let default = ConstantKind :: Local { def_id : local_did, body : expr } ;
10651065 AssocConstItem ( ty. clean ( cx) , default)
10661066 }
10671067 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) ;
10691069 let defaultness = cx. tcx . associated_item ( self . def_id ) . defaultness ;
10701070 MethodItem ( m, Some ( defaultness) )
10711071 }
1072- hir:: ImplItemKind :: TyAlias ( ref hir_ty) => {
1072+ hir:: ImplItemKind :: TyAlias ( hir_ty) => {
10731073 let type_ = hir_ty. clean ( cx) ;
10741074 let generics = self . generics . clean ( cx) ;
10751075 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
12921292 let hir:: TyKind :: Path ( qpath) = kind else { unreachable ! ( ) } ;
12931293
12941294 match qpath {
1295- hir:: QPath :: Resolved ( None , ref path) => {
1295+ hir:: QPath :: Resolved ( None , path) => {
12961296 if let Res :: Def ( DefKind :: TyParam , did) = path. res {
12971297 if let Some ( new_ty) = cx. substs . get ( & did) . and_then ( |p| p. as_ty ( ) ) . cloned ( ) {
12981298 return new_ty;
@@ -1309,7 +1309,7 @@ fn clean_qpath<'tcx>(hir_ty: &hir::Ty<'tcx>, cx: &mut DocContext<'tcx>) -> Type
13091309 resolve_type ( cx, path)
13101310 }
13111311 }
1312- hir:: QPath :: Resolved ( Some ( ref qself) , p) => {
1312+ hir:: QPath :: Resolved ( Some ( qself) , p) => {
13131313 // Try to normalize `<X as Y>::T` to a type
13141314 let ty = hir_ty_to_ty ( cx. tcx , hir_ty) ;
13151315 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
13331333 trait_,
13341334 }
13351335 }
1336- hir:: QPath :: TypeRelative ( ref qself, segment) => {
1336+ hir:: QPath :: TypeRelative ( qself, segment) => {
13371337 let ty = hir_ty_to_ty ( cx. tcx , hir_ty) ;
13381338 let res = match ty. kind ( ) {
13391339 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> {
14631463 let lifetime = if elided { None } else { Some ( l. clean ( cx) ) } ;
14641464 BorrowedRef { lifetime, mutability : m. mutbl , type_ : box m. ty . clean ( cx) }
14651465 }
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) => {
14681468 let length = match length {
14691469 hir:: ArrayLen :: Infer ( _, _) => "_" . to_string ( ) ,
14701470 hir:: ArrayLen :: Body ( anon_const) => {
@@ -1499,7 +1499,7 @@ impl<'tcx> Clean<'tcx, Type> for hir::Ty<'tcx> {
14991499 let lifetime = if !lifetime. is_elided ( ) { Some ( lifetime. clean ( cx) ) } else { None } ;
15001500 DynTrait ( bounds, lifetime)
15011501 }
1502- TyKind :: BareFn ( ref barefn) => BareFunction ( box barefn. clean ( cx) ) ,
1502+ TyKind :: BareFn ( barefn) => BareFunction ( box barefn. clean ( cx) ) ,
15031503 // Rustdoc handles `TyKind::Err`s by turning them into `Type::Infer`s.
15041504 TyKind :: Infer | TyKind :: Err => Infer ,
15051505 TyKind :: Typeof ( ..) => panic ! ( "unimplemented type {:?}" , self . kind) ,
@@ -1908,7 +1908,7 @@ fn clean_maybe_renamed_item<'tcx>(
19081908 bounds : ty. bounds . iter ( ) . filter_map ( |x| x. clean ( cx) ) . collect ( ) ,
19091909 generics : ty. generics . clean ( cx) ,
19101910 } ) ,
1911- ItemKind :: TyAlias ( hir_ty, ref generics) => {
1911+ ItemKind :: TyAlias ( hir_ty, generics) => {
19121912 let rustdoc_ty = hir_ty. clean ( cx) ;
19131913 let ty = hir_ty_to_ty ( cx. tcx , hir_ty) . clean ( cx) ;
19141914 TypedefItem ( Typedef {
@@ -1917,26 +1917,26 @@ fn clean_maybe_renamed_item<'tcx>(
19171917 item_type : Some ( ty) ,
19181918 } )
19191919 }
1920- ItemKind :: Enum ( ref def, ref generics) => EnumItem ( Enum {
1920+ ItemKind :: Enum ( ref def, generics) => EnumItem ( Enum {
19211921 variants : def. variants . iter ( ) . map ( |v| v. clean ( cx) ) . collect ( ) ,
19221922 generics : generics. clean ( cx) ,
19231923 } ) ,
1924- ItemKind :: TraitAlias ( ref generics, bounds) => TraitAliasItem ( TraitAlias {
1924+ ItemKind :: TraitAlias ( generics, bounds) => TraitAliasItem ( TraitAlias {
19251925 generics : generics. clean ( cx) ,
19261926 bounds : bounds. iter ( ) . filter_map ( |x| x. clean ( cx) ) . collect ( ) ,
19271927 } ) ,
1928- ItemKind :: Union ( ref variant_data, ref generics) => UnionItem ( Union {
1928+ ItemKind :: Union ( ref variant_data, generics) => UnionItem ( Union {
19291929 generics : generics. clean ( cx) ,
19301930 fields : variant_data. fields ( ) . iter ( ) . map ( |x| x. clean ( cx) ) . collect ( ) ,
19311931 } ) ,
1932- ItemKind :: Struct ( ref variant_data, ref generics) => StructItem ( Struct {
1932+ ItemKind :: Struct ( ref variant_data, generics) => StructItem ( Struct {
19331933 struct_type : CtorKind :: from_hir ( variant_data) ,
19341934 generics : generics. clean ( cx) ,
19351935 fields : variant_data. fields ( ) . iter ( ) . map ( |x| x. clean ( cx) ) . collect ( ) ,
19361936 } ) ,
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) ,
19381938 // 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) => {
19401940 clean_fn_or_proc_macro ( item, sig, generics, body_id, & mut name, cx)
19411941 }
19421942 ItemKind :: Macro ( ref macro_def, _) => {
@@ -1945,7 +1945,7 @@ fn clean_maybe_renamed_item<'tcx>(
19451945 source : display_macro_source ( cx, name, macro_def, def_id, ty_vis) ,
19461946 } )
19471947 }
1948- ItemKind :: Trait ( is_auto, unsafety, ref generics, bounds, item_ids) => {
1948+ ItemKind :: Trait ( is_auto, unsafety, generics, bounds, item_ids) => {
19491949 let items =
19501950 item_ids. iter ( ) . map ( |ti| cx. tcx . hir ( ) . trait_item ( ti. id ) . clean ( cx) ) . collect ( ) ;
19511951 TraitItem ( Trait {
@@ -2192,7 +2192,7 @@ fn clean_maybe_renamed_foreign_item<'tcx>(
21922192 let def_id = item. def_id . to_def_id ( ) ;
21932193 cx. with_param_env ( def_id, |cx| {
21942194 let kind = match item. kind {
2195- hir:: ForeignItemKind :: Fn ( decl, names, ref generics) => {
2195+ hir:: ForeignItemKind :: Fn ( decl, names, generics) => {
21962196 let ( generics, decl) = enter_impl_trait ( cx, |cx| {
21972197 // NOTE: generics must be cleaned before args
21982198 let generics = generics. clean ( cx) ;
@@ -2202,7 +2202,7 @@ fn clean_maybe_renamed_foreign_item<'tcx>(
22022202 } ) ;
22032203 ForeignFunctionItem ( Function { decl, generics } )
22042204 }
2205- hir:: ForeignItemKind :: Static ( ref ty, mutability) => {
2205+ hir:: ForeignItemKind :: Static ( ty, mutability) => {
22062206 ForeignStaticItem ( Static { type_ : ty. clean ( cx) , mutability, expr : None } )
22072207 }
22082208 hir:: ForeignItemKind :: Type => ForeignTypeItem ,
@@ -2232,7 +2232,7 @@ impl<'tcx> Clean<'tcx, TypeBindingKind> for hir::TypeBindingKind<'tcx> {
22322232 hir:: TypeBindingKind :: Equality { ref term } => {
22332233 TypeBindingKind :: Equality { term : term. clean ( cx) }
22342234 }
2235- hir:: TypeBindingKind :: Constraint { ref bounds } => TypeBindingKind :: Constraint {
2235+ hir:: TypeBindingKind :: Constraint { bounds } => TypeBindingKind :: Constraint {
22362236 bounds : bounds. iter ( ) . filter_map ( |b| b. clean ( cx) ) . collect ( ) ,
22372237 } ,
22382238 }
0 commit comments