@@ -787,43 +787,43 @@ fn clean_ty_generics<'tcx>(
787
787
None
788
788
} ) ( ) ;
789
789
790
- if let Some ( param_idx) = param_idx {
791
- if let Some ( b) = impl_trait. get_mut ( & param_idx. into ( ) ) {
792
- let p: WherePredicate = clean_predicate ( * p, cx) ?;
790
+ if let Some ( param_idx) = param_idx
791
+ && let Some ( b) = impl_trait. get_mut ( & param_idx. into ( ) )
792
+ {
793
+ let p: WherePredicate = clean_predicate ( * p, cx) ?;
794
+
795
+ b. extend (
796
+ p. get_bounds ( )
797
+ . into_iter ( )
798
+ . flatten ( )
799
+ . cloned ( )
800
+ . filter ( |b| !b. is_sized_bound ( cx) ) ,
801
+ ) ;
793
802
794
- b. extend (
795
- p. get_bounds ( )
803
+ let proj = projection. map ( |p| {
804
+ (
805
+ clean_projection ( p. map_bound ( |p| p. projection_ty ) , cx, None ) ,
806
+ p. map_bound ( |p| p. term ) ,
807
+ )
808
+ } ) ;
809
+ if let Some ( ( ( _, trait_did, name) , rhs) ) = proj
810
+ . as_ref ( )
811
+ . and_then ( |( lhs, rhs) : & ( Type , _ ) | Some ( ( lhs. projection ( ) ?, rhs) ) )
812
+ {
813
+ // FIXME(...): Remove this unwrap()
814
+ impl_trait_proj. entry ( param_idx) . or_default ( ) . push ( (
815
+ trait_did,
816
+ name,
817
+ rhs. map_bound ( |rhs| rhs. ty ( ) . unwrap ( ) ) ,
818
+ p. get_bound_params ( )
796
819
. into_iter ( )
797
820
. flatten ( )
798
- . cloned ( )
799
- . filter ( |b| !b. is_sized_bound ( cx) ) ,
800
- ) ;
801
-
802
- let proj = projection. map ( |p| {
803
- (
804
- clean_projection ( p. map_bound ( |p| p. projection_ty ) , cx, None ) ,
805
- p. map_bound ( |p| p. term ) ,
806
- )
807
- } ) ;
808
- if let Some ( ( ( _, trait_did, name) , rhs) ) = proj
809
- . as_ref ( )
810
- . and_then ( |( lhs, rhs) : & ( Type , _ ) | Some ( ( lhs. projection ( ) ?, rhs) ) )
811
- {
812
- // FIXME(...): Remove this unwrap()
813
- impl_trait_proj. entry ( param_idx) . or_default ( ) . push ( (
814
- trait_did,
815
- name,
816
- rhs. map_bound ( |rhs| rhs. ty ( ) . unwrap ( ) ) ,
817
- p. get_bound_params ( )
818
- . into_iter ( )
819
- . flatten ( )
820
- . map ( |param| GenericParamDef :: lifetime ( param. 0 ) )
821
- . collect ( ) ,
822
- ) ) ;
823
- }
824
-
825
- return None ;
821
+ . map ( |param| GenericParamDef :: lifetime ( param. 0 ) )
822
+ . collect ( ) ,
823
+ ) ) ;
826
824
}
825
+
826
+ return None ;
827
827
}
828
828
829
829
Some ( p)
@@ -886,7 +886,7 @@ fn clean_ty_generics<'tcx>(
886
886
// `?Sized` bound for each one we didn't find to be `Sized`.
887
887
for tp in & stripped_params {
888
888
if let types:: GenericParamDefKind :: Type { .. } = tp. kind
889
- && !sized_params. contains ( & tp. name )
889
+ && !sized_params. contains ( & tp. name )
890
890
{
891
891
where_predicates. push ( WherePredicate :: BoundPredicate {
892
892
ty : Type :: Generic ( tp. name ) ,
@@ -1461,10 +1461,10 @@ fn clean_qpath<'tcx>(hir_ty: &hir::Ty<'tcx>, cx: &mut DocContext<'tcx>) -> Type
1461
1461
// Try to normalize `<X as Y>::T` to a type
1462
1462
let ty = hir_ty_to_ty ( cx. tcx , hir_ty) ;
1463
1463
// `hir_to_ty` can return projection types with escaping vars for GATs, e.g. `<() as Trait>::Gat<'_>`
1464
- if !ty. has_escaping_bound_vars ( ) {
1465
- if let Some ( normalized_value) = normalize ( cx, ty:: Binder :: dummy ( ty) ) {
1466
- return clean_middle_ty ( normalized_value , cx , None ) ;
1467
- }
1464
+ if !ty. has_escaping_bound_vars ( )
1465
+ && let Some ( normalized_value) = normalize ( cx, ty:: Binder :: dummy ( ty) )
1466
+ {
1467
+ return clean_middle_ty ( normalized_value , cx , None ) ;
1468
1468
}
1469
1469
1470
1470
let trait_segments = & p. segments [ ..p. segments . len ( ) - 1 ] ;
@@ -1878,11 +1878,9 @@ fn clean_middle_opaque_bounds<'tcx>(
1878
1878
_ => return None ,
1879
1879
} ;
1880
1880
1881
- if let Some ( sized) = cx. tcx . lang_items ( ) . sized_trait ( ) {
1882
- if trait_ref. def_id ( ) == sized {
1883
- has_sized = true ;
1884
- return None ;
1885
- }
1881
+ if let Some ( sized) = cx. tcx . lang_items ( ) . sized_trait ( ) && trait_ref. def_id ( ) == sized {
1882
+ has_sized = true ;
1883
+ return None ;
1886
1884
}
1887
1885
1888
1886
let bindings: ThinVec < _ > = bounds
@@ -2392,17 +2390,15 @@ fn clean_use_statement_inner<'tcx>(
2392
2390
let is_visible_from_parent_mod =
2393
2391
visibility. is_accessible_from ( parent_mod, cx. tcx ) && !current_mod. is_top_level_module ( ) ;
2394
2392
2395
- if pub_underscore {
2396
- if let Some ( ref inline) = inline_attr {
2397
- rustc_errors:: struct_span_err!(
2398
- cx. tcx. sess,
2399
- inline. span( ) ,
2400
- E0780 ,
2401
- "anonymous imports cannot be inlined"
2402
- )
2403
- . span_label ( import. span , "anonymous import" )
2404
- . emit ( ) ;
2405
- }
2393
+ if pub_underscore && let Some ( ref inline) = inline_attr {
2394
+ rustc_errors:: struct_span_err!(
2395
+ cx. tcx. sess,
2396
+ inline. span( ) ,
2397
+ E0780 ,
2398
+ "anonymous imports cannot be inlined"
2399
+ )
2400
+ . span_label ( import. span , "anonymous import" )
2401
+ . emit ( ) ;
2406
2402
}
2407
2403
2408
2404
// We consider inlining the documentation of `pub use` statements, but we
@@ -2438,14 +2434,13 @@ fn clean_use_statement_inner<'tcx>(
2438
2434
}
2439
2435
Import :: new_glob ( resolve_use_source ( cx, path) , true )
2440
2436
} else {
2441
- if inline_attr. is_none ( ) {
2442
- if let Res :: Def ( DefKind :: Mod , did) = path. res {
2443
- if !did. is_local ( ) && did. is_crate_root ( ) {
2444
- // if we're `pub use`ing an extern crate root, don't inline it unless we
2445
- // were specifically asked for it
2446
- denied = true ;
2447
- }
2448
- }
2437
+ if inline_attr. is_none ( )
2438
+ && let Res :: Def ( DefKind :: Mod , did) = path. res
2439
+ && !did. is_local ( ) && did. is_crate_root ( )
2440
+ {
2441
+ // if we're `pub use`ing an extern crate root, don't inline it unless we
2442
+ // were specifically asked for it
2443
+ denied = true ;
2449
2444
}
2450
2445
if !denied {
2451
2446
let mut visited = DefIdSet :: default ( ) ;
0 commit comments