@@ -216,17 +216,15 @@ impl<'tcx> Clean<GenericBound> for ty::PolyTraitRef<'tcx> {
216216impl Clean < Lifetime > for hir:: Lifetime {
217217 fn clean ( & self , cx : & mut DocContext < ' _ > ) -> Lifetime {
218218 let def = cx. tcx . named_region ( self . hir_id ) ;
219- match def {
220- Some (
221- rl:: Region :: EarlyBound ( _, node_id, _)
222- | rl:: Region :: LateBound ( _, _, node_id, _)
223- | rl:: Region :: Free ( _, node_id) ,
224- ) => {
225- if let Some ( lt) = cx. lt_substs . get ( & node_id) . cloned ( ) {
226- return lt;
227- }
219+ if let Some (
220+ rl:: Region :: EarlyBound ( _, node_id, _)
221+ | rl:: Region :: LateBound ( _, _, node_id, _)
222+ | rl:: Region :: Free ( _, node_id) ,
223+ ) = def
224+ {
225+ if let Some ( lt) = cx. lt_substs . get ( & node_id) . cloned ( ) {
226+ return lt;
228227 }
229- _ => { }
230228 }
231229 Lifetime ( self . name . ident ( ) . name )
232230 }
@@ -828,7 +826,7 @@ impl<'a> Clean<Arguments> for (&'a [hir::Ty<'a>], hir::BodyId) {
828826 . iter ( )
829827 . enumerate ( )
830828 . map ( |( i, ty) | Argument {
831- name : name_from_pat ( & body. params [ i] . pat ) ,
829+ name : name_from_pat ( body. params [ i] . pat ) ,
832830 type_ : ty. clean ( cx) ,
833831 } )
834832 . collect ( ) ,
@@ -924,7 +922,7 @@ impl Clean<Item> for hir::TraitItem<'_> {
924922 }
925923 MethodItem ( m, None )
926924 }
927- hir:: TraitItemKind :: Fn ( ref sig, hir:: TraitFn :: Required ( ref names) ) => {
925+ hir:: TraitItemKind :: Fn ( ref sig, hir:: TraitFn :: Required ( names) ) => {
928926 let ( generics, decl) = enter_impl_trait ( cx, |cx| {
929927 ( self . generics . clean ( cx) , ( & * sig. decl , & names[ ..] ) . clean ( cx) )
930928 } ) ;
@@ -936,7 +934,7 @@ impl Clean<Item> for hir::TraitItem<'_> {
936934 }
937935 TyMethodItem ( t)
938936 }
939- hir:: TraitItemKind :: Type ( ref bounds, ref default) => {
937+ hir:: TraitItemKind :: Type ( bounds, ref default) => {
940938 AssocTypeItem ( bounds. clean ( cx) , default. clean ( cx) )
941939 }
942940 } ;
@@ -1260,7 +1258,7 @@ fn clean_qpath(hir_ty: &hir::Ty<'_>, cx: &mut DocContext<'_>) -> Type {
12601258 let path = path. clean ( cx) ;
12611259 resolve_type ( cx, path)
12621260 }
1263- hir:: QPath :: Resolved ( Some ( ref qself) , ref p) => {
1261+ hir:: QPath :: Resolved ( Some ( ref qself) , p) => {
12641262 // Try to normalize `<X as Y>::T` to a type
12651263 let ty = hir_ty_to_ty ( cx. tcx , hir_ty) ;
12661264 if let Some ( normalized_value) = normalize ( cx, ty) {
@@ -1281,7 +1279,7 @@ fn clean_qpath(hir_ty: &hir::Ty<'_>, cx: &mut DocContext<'_>) -> Type {
12811279 trait_,
12821280 }
12831281 }
1284- hir:: QPath :: TypeRelative ( ref qself, ref segment) => {
1282+ hir:: QPath :: TypeRelative ( ref qself, segment) => {
12851283 let ty = hir_ty_to_ty ( cx. tcx , hir_ty) ;
12861284 let res = match ty. kind ( ) {
12871285 ty:: Projection ( proj) => Res :: Def ( DefKind :: Trait , proj. trait_ref ( cx. tcx ) . def_id ) ,
@@ -1337,7 +1335,7 @@ impl Clean<Type> for hir::Ty<'_> {
13371335 let length = print_const ( cx, ct. eval ( cx. tcx , param_env) ) ;
13381336 Array ( box ty. clean ( cx) , length)
13391337 }
1340- TyKind :: Tup ( ref tys) => Tuple ( tys. clean ( cx) ) ,
1338+ TyKind :: Tup ( tys) => Tuple ( tys. clean ( cx) ) ,
13411339 TyKind :: OpaqueDef ( item_id, _) => {
13421340 let item = cx. tcx . hir ( ) . item ( item_id) ;
13431341 if let hir:: ItemKind :: OpaqueTy ( ref ty) = item. kind {
@@ -1346,8 +1344,8 @@ impl Clean<Type> for hir::Ty<'_> {
13461344 unreachable ! ( )
13471345 }
13481346 }
1349- TyKind :: Path ( _) => clean_qpath ( & self , cx) ,
1350- TyKind :: TraitObject ( ref bounds, ref lifetime, _) => {
1347+ TyKind :: Path ( _) => clean_qpath ( self , cx) ,
1348+ TyKind :: TraitObject ( bounds, ref lifetime, _) => {
13511349 let bounds = bounds. iter ( ) . map ( |bound| bound. clean ( cx) ) . collect ( ) ;
13521350 let lifetime = if !lifetime. is_elided ( ) { Some ( lifetime. clean ( cx) ) } else { None } ;
13531351 DynTrait ( bounds, lifetime)
@@ -1441,7 +1439,7 @@ impl<'tcx> Clean<Type> for Ty<'tcx> {
14411439 let path = external_path ( cx, did, false , vec ! [ ] , InternalSubsts :: empty ( ) ) ;
14421440 ResolvedPath { path, did }
14431441 }
1444- ty:: Dynamic ( ref obj, ref reg) => {
1442+ ty:: Dynamic ( obj, ref reg) => {
14451443 // HACK: pick the first `did` as the `did` of the trait object. Someone
14461444 // might want to implement "native" support for marker-trait-only
14471445 // trait objects.
@@ -1481,9 +1479,7 @@ impl<'tcx> Clean<Type> for Ty<'tcx> {
14811479
14821480 DynTrait ( bounds, lifetime)
14831481 }
1484- ty:: Tuple ( ref t) => {
1485- Tuple ( t. iter ( ) . map ( |t| t. expect_ty ( ) ) . collect :: < Vec < _ > > ( ) . clean ( cx) )
1486- }
1482+ ty:: Tuple ( t) => Tuple ( t. iter ( ) . map ( |t| t. expect_ty ( ) ) . collect :: < Vec < _ > > ( ) . clean ( cx) ) ,
14871483
14881484 ty:: Projection ( ref data) => data. clean ( cx) ,
14891485
@@ -1821,9 +1817,9 @@ impl Clean<Vec<Item>> for (&hir::Item<'_>, Option<Symbol>) {
18211817 clean_fn_or_proc_macro ( item, sig, generics, body_id, & mut name, cx)
18221818 }
18231819 ItemKind :: Macro ( ref macro_def) => MacroItem ( Macro {
1824- source : display_macro_source ( cx, name, & macro_def, def_id, & item. vis ) ,
1820+ source : display_macro_source ( cx, name, macro_def, def_id, & item. vis ) ,
18251821 } ) ,
1826- ItemKind :: Trait ( is_auto, unsafety, ref generics, ref bounds, ref item_ids) => {
1822+ ItemKind :: Trait ( is_auto, unsafety, ref generics, bounds, item_ids) => {
18271823 let items = item_ids
18281824 . iter ( )
18291825 . map ( |ti| cx. tcx . hir ( ) . trait_item ( ti. id ) . clean ( cx) )
@@ -2065,10 +2061,10 @@ impl Clean<Item> for (&hir::ForeignItem<'_>, Option<Symbol>) {
20652061 let def_id = item. def_id . to_def_id ( ) ;
20662062 cx. with_param_env ( def_id, |cx| {
20672063 let kind = match item. kind {
2068- hir:: ForeignItemKind :: Fn ( ref decl, ref names, ref generics) => {
2064+ hir:: ForeignItemKind :: Fn ( decl, names, ref generics) => {
20692065 let abi = cx. tcx . hir ( ) . get_foreign_abi ( item. hir_id ( ) ) ;
20702066 let ( generics, decl) = enter_impl_trait ( cx, |cx| {
2071- ( generics. clean ( cx) , ( & * * decl, & names[ ..] ) . clean ( cx) )
2067+ ( generics. clean ( cx) , ( & * decl, & names[ ..] ) . clean ( cx) )
20722068 } ) ;
20732069 ForeignFunctionItem ( Function {
20742070 decl,
@@ -2113,7 +2109,7 @@ impl Clean<TypeBindingKind> for hir::TypeBindingKind<'_> {
21132109 hir:: TypeBindingKind :: Equality { ref ty } => {
21142110 TypeBindingKind :: Equality { ty : ty. clean ( cx) }
21152111 }
2116- hir:: TypeBindingKind :: Constraint { ref bounds } => {
2112+ hir:: TypeBindingKind :: Constraint { bounds } => {
21172113 TypeBindingKind :: Constraint { bounds : bounds. iter ( ) . map ( |b| b. clean ( cx) ) . collect ( ) }
21182114 }
21192115 }
0 commit comments