@@ -828,30 +828,26 @@ fn clean_ty_generics<'tcx>(
828
828
. iter ( )
829
829
. flat_map ( |( pred, _) | {
830
830
let mut projection = None ;
831
- let param_idx = ( || {
831
+ let param_idx = {
832
832
let bound_p = pred. kind ( ) ;
833
833
match bound_p. skip_binder ( ) {
834
- ty:: ClauseKind :: Trait ( pred) => {
835
- if let ty:: Param ( param) = pred. self_ty ( ) . kind ( ) {
836
- return Some ( param. index ) ;
837
- }
834
+ ty:: ClauseKind :: Trait ( pred) if let ty:: Param ( param) = pred. self_ty ( ) . kind ( ) => {
835
+ Some ( param. index )
838
836
}
839
- ty:: ClauseKind :: TypeOutlives ( ty:: OutlivesPredicate ( ty, _reg) ) => {
840
- if let ty:: Param ( param) = ty. kind ( ) {
841
- return Some ( param . index ) ;
842
- }
837
+ ty:: ClauseKind :: TypeOutlives ( ty:: OutlivesPredicate ( ty, _reg) )
838
+ if let ty:: Param ( param) = ty. kind ( ) =>
839
+ {
840
+ Some ( param . index )
843
841
}
844
- ty:: ClauseKind :: Projection ( p) => {
845
- if let ty:: Param ( param) = p. projection_term . self_ty ( ) . kind ( ) {
846
- projection = Some ( bound_p . rebind ( p ) ) ;
847
- return Some ( param . index ) ;
848
- }
842
+ ty:: ClauseKind :: Projection ( p)
843
+ if let ty:: Param ( param) = p. projection_term . self_ty ( ) . kind ( ) =>
844
+ {
845
+ projection = Some ( bound_p . rebind ( p ) ) ;
846
+ Some ( param . index )
849
847
}
850
- _ => ( ) ,
848
+ _ => None ,
851
849
}
852
-
853
- None
854
- } ) ( ) ;
850
+ } ;
855
851
856
852
if let Some ( param_idx) = param_idx
857
853
&& let Some ( bounds) = impl_trait. get_mut ( & param_idx)
@@ -1378,12 +1374,12 @@ pub(crate) fn clean_middle_assoc_item(assoc_item: &ty::AssocItem, cx: &mut DocCo
1378
1374
tcx. fn_sig ( assoc_item. def_id ) . instantiate_identity ( ) . input ( 0 ) . skip_binder ( ) ;
1379
1375
if self_arg_ty == self_ty {
1380
1376
item. decl . inputs . values [ 0 ] . type_ = SelfTy ;
1381
- } else if let ty:: Ref ( _, ty, _) = * self_arg_ty. kind ( ) {
1382
- if ty == self_ty {
1383
- match item . decl . inputs . values [ 0 ] . type_ {
1384
- BorrowedRef { ref mut type_ , .. } => * * type_ = SelfTy ,
1385
- _ => unreachable ! ( ) ,
1386
- }
1377
+ } else if let ty:: Ref ( _, ty, _) = * self_arg_ty. kind ( )
1378
+ && ty == self_ty
1379
+ {
1380
+ match item . decl . inputs . values [ 0 ] . type_ {
1381
+ BorrowedRef { ref mut type_ , .. } => * * type_ = SelfTy ,
1382
+ _ => unreachable ! ( ) ,
1387
1383
}
1388
1384
}
1389
1385
}
@@ -2331,25 +2327,22 @@ fn clean_middle_opaque_bounds<'tcx>(
2331
2327
let bindings: ThinVec < _ > = bounds
2332
2328
. iter ( )
2333
2329
. filter_map ( |( bound, _) | {
2334
- if let ty:: ClauseKind :: Projection ( proj) = bound. kind ( ) . skip_binder ( ) {
2335
- if proj. projection_term . trait_ref ( cx. tcx ) == trait_ref. skip_binder ( ) {
2336
- Some ( AssocItemConstraint {
2337
- assoc : projection_to_path_segment (
2338
- // FIXME: This needs to be made resilient for `AliasTerm`s that
2339
- // are associated consts.
2340
- bound. kind ( ) . rebind ( proj. projection_term . expect_ty ( cx. tcx ) ) ,
2341
- cx,
2342
- ) ,
2343
- kind : AssocItemConstraintKind :: Equality {
2344
- term : clean_middle_term ( bound. kind ( ) . rebind ( proj. term ) , cx) ,
2345
- } ,
2346
- } )
2347
- } else {
2348
- None
2349
- }
2350
- } else {
2351
- None
2330
+ if let ty:: ClauseKind :: Projection ( proj) = bound. kind ( ) . skip_binder ( )
2331
+ && proj. projection_term . trait_ref ( cx. tcx ) == trait_ref. skip_binder ( )
2332
+ {
2333
+ return Some ( AssocItemConstraint {
2334
+ assoc : projection_to_path_segment (
2335
+ // FIXME: This needs to be made resilient for `AliasTerm`s that
2336
+ // are associated consts.
2337
+ bound. kind ( ) . rebind ( proj. projection_term . expect_ty ( cx. tcx ) ) ,
2338
+ cx,
2339
+ ) ,
2340
+ kind : AssocItemConstraintKind :: Equality {
2341
+ term : clean_middle_term ( bound. kind ( ) . rebind ( proj. term ) , cx) ,
2342
+ } ,
2343
+ } ) ;
2352
2344
}
2345
+ None
2353
2346
} )
2354
2347
. collect ( ) ;
2355
2348
@@ -2743,23 +2736,20 @@ fn add_without_unwanted_attributes<'hir>(
2743
2736
}
2744
2737
let mut attr = attr. clone ( ) ;
2745
2738
match attr {
2746
- hir:: Attribute :: Unparsed ( ref mut normal) => {
2747
- if let [ ident] = & * normal. path . segments {
2748
- let ident = ident. name ;
2749
- if ident == sym:: doc {
2750
- filter_doc_attr ( & mut normal. args , is_inline) ;
2751
- attrs. push ( ( Cow :: Owned ( attr) , import_parent) ) ;
2752
- } else if is_inline || ident != sym:: cfg {
2753
- // If it's not a `cfg()` attribute, we keep it.
2754
- attrs. push ( ( Cow :: Owned ( attr) , import_parent) ) ;
2755
- }
2756
- }
2757
- }
2758
- hir:: Attribute :: Parsed ( ..) => {
2759
- if is_inline {
2739
+ hir:: Attribute :: Unparsed ( ref mut normal) if let [ ident] = & * normal. path . segments => {
2740
+ let ident = ident. name ;
2741
+ if ident == sym:: doc {
2742
+ filter_doc_attr ( & mut normal. args , is_inline) ;
2743
+ attrs. push ( ( Cow :: Owned ( attr) , import_parent) ) ;
2744
+ } else if is_inline || ident != sym:: cfg {
2745
+ // If it's not a `cfg()` attribute, we keep it.
2760
2746
attrs. push ( ( Cow :: Owned ( attr) , import_parent) ) ;
2761
2747
}
2762
2748
}
2749
+ hir:: Attribute :: Parsed ( ..) if is_inline => {
2750
+ attrs. push ( ( Cow :: Owned ( attr) , import_parent) ) ;
2751
+ }
2752
+ _ => { }
2763
2753
}
2764
2754
}
2765
2755
}
@@ -2961,16 +2951,16 @@ fn clean_extern_crate<'tcx>(
2961
2951
&& !cx. is_json_output ( ) ;
2962
2952
2963
2953
let krate_owner_def_id = krate. owner_id . def_id ;
2964
- if please_inline {
2965
- if let Some ( items) = inline:: try_inline (
2954
+ if please_inline
2955
+ && let Some ( items) = inline:: try_inline (
2966
2956
cx,
2967
2957
Res :: Def ( DefKind :: Mod , crate_def_id) ,
2968
2958
name,
2969
2959
Some ( ( attrs, Some ( krate_owner_def_id) ) ) ,
2970
2960
& mut Default :: default ( ) ,
2971
- ) {
2972
- return items ;
2973
- }
2961
+ )
2962
+ {
2963
+ return items ;
2974
2964
}
2975
2965
2976
2966
vec ! [ Item :: from_def_id_and_parts(
0 commit comments