@@ -787,43 +787,43 @@ fn clean_ty_generics<'tcx>(
787787 None
788788 } ) ( ) ;
789789
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+ ) ;
793802
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 ( )
796819 . into_iter ( )
797820 . 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+ ) ) ;
826824 }
825+
826+ return None ;
827827 }
828828
829829 Some ( p)
@@ -886,7 +886,7 @@ fn clean_ty_generics<'tcx>(
886886 // `?Sized` bound for each one we didn't find to be `Sized`.
887887 for tp in & stripped_params {
888888 if let types:: GenericParamDefKind :: Type { .. } = tp. kind
889- && !sized_params. contains ( & tp. name )
889+ && !sized_params. contains ( & tp. name )
890890 {
891891 where_predicates. push ( WherePredicate :: BoundPredicate {
892892 ty : Type :: Generic ( tp. name ) ,
@@ -1461,10 +1461,10 @@ fn clean_qpath<'tcx>(hir_ty: &hir::Ty<'tcx>, cx: &mut DocContext<'tcx>) -> Type
14611461 // Try to normalize `<X as Y>::T` to a type
14621462 let ty = hir_ty_to_ty ( cx. tcx , hir_ty) ;
14631463 // `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 ) ;
14681468 }
14691469
14701470 let trait_segments = & p. segments [ ..p. segments . len ( ) - 1 ] ;
@@ -1878,11 +1878,9 @@ fn clean_middle_opaque_bounds<'tcx>(
18781878 _ => return None ,
18791879 } ;
18801880
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 ;
18861884 }
18871885
18881886 let bindings: ThinVec < _ > = bounds
@@ -2392,17 +2390,15 @@ fn clean_use_statement_inner<'tcx>(
23922390 let is_visible_from_parent_mod =
23932391 visibility. is_accessible_from ( parent_mod, cx. tcx ) && !current_mod. is_top_level_module ( ) ;
23942392
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 ( ) ;
24062402 }
24072403
24082404 // We consider inlining the documentation of `pub use` statements, but we
@@ -2438,14 +2434,13 @@ fn clean_use_statement_inner<'tcx>(
24382434 }
24392435 Import :: new_glob ( resolve_use_source ( cx, path) , true )
24402436 } 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 ;
24492444 }
24502445 if !denied {
24512446 let mut visited = DefIdSet :: default ( ) ;
0 commit comments