@@ -187,11 +187,10 @@ pub(crate) fn build_index<'tcx>(
187187 lastpathid,
188188 crate_paths,
189189 ) ;
190- if let Some ( converted_associated_type) = converted_associated_type {
191- * associated_type = converted_associated_type;
192- } else {
190+ let Some ( converted_associated_type) = converted_associated_type else {
193191 return false ;
194- }
192+ } ;
193+ * associated_type = converted_associated_type;
195194 for constraint in constraints {
196195 convert_render_type (
197196 constraint,
@@ -516,20 +515,23 @@ pub(crate) fn get_function_type_for_search<'tcx>(
516515) -> Option < IndexItemFunctionType > {
517516 let mut trait_info = None ;
518517 let impl_or_trait_generics = impl_generics. or_else ( || {
519- if let Some ( def_id) = parent &&
520- let Some ( trait_) = cache. traits . get ( & def_id) &&
521- let Some ( ( path, _) ) = cache . paths . get ( & def_id )
522- . or_else ( || cache. external_paths . get ( & def_id) )
518+ if let Some ( def_id) = parent
519+ && let Some ( trait_) = cache. traits . get ( & def_id)
520+ && let Some ( ( path, _) ) =
521+ cache . paths . get ( & def_id ) . or_else ( || cache. external_paths . get ( & def_id) )
523522 {
524523 let path = clean:: Path {
525524 res : rustc_hir:: def:: Res :: Def ( rustc_hir:: def:: DefKind :: Trait , def_id) ,
526- segments : path. iter ( ) . map ( |name| clean:: PathSegment {
527- name : * name,
528- args : clean:: GenericArgs :: AngleBracketed {
529- args : Vec :: new ( ) . into_boxed_slice ( ) ,
530- bindings : ThinVec :: new ( ) ,
531- } ,
532- } ) . collect ( ) ,
525+ segments : path
526+ . iter ( )
527+ . map ( |name| clean:: PathSegment {
528+ name : * name,
529+ args : clean:: GenericArgs :: AngleBracketed {
530+ args : Vec :: new ( ) . into_boxed_slice ( ) ,
531+ bindings : ThinVec :: new ( ) ,
532+ } ,
533+ } )
534+ . collect ( ) ,
533535 } ;
534536 trait_info = Some ( ( clean:: Type :: Path { path } , trait_. generics . clone ( ) ) ) ;
535537 Some ( trait_info. as_ref ( ) . unwrap ( ) )
@@ -538,15 +540,9 @@ pub(crate) fn get_function_type_for_search<'tcx>(
538540 }
539541 } ) ;
540542 let ( mut inputs, mut output, where_clause) = match * item. kind {
541- clean:: FunctionItem ( ref f) => {
543+ clean:: FunctionItem ( ref f) | clean :: MethodItem ( ref f , _ ) | clean :: TyMethodItem ( ref f ) => {
542544 get_fn_inputs_and_outputs ( f, tcx, impl_or_trait_generics, cache)
543545 }
544- clean:: MethodItem ( ref m, _) => {
545- get_fn_inputs_and_outputs ( m, tcx, impl_or_trait_generics, cache)
546- }
547- clean:: TyMethodItem ( ref m) => {
548- get_fn_inputs_and_outputs ( m, tcx, impl_or_trait_generics, cache)
549- }
550546 _ => return None ,
551547 } ;
552548
@@ -591,20 +587,16 @@ fn get_index_type_id(
591587 && let Some ( clean:: Path { res : Res :: Def ( DefKind :: Trait , trait_) , .. } ) = data. trait_
592588 {
593589 let idx = -isize:: try_from ( rgen. len ( ) + 1 ) . unwrap ( ) ;
594- let ( idx, _) = rgen. entry ( SimplifiedParam :: AssociatedType ( trait_, data. assoc . name ) )
595- . or_insert_with ( || {
596- ( idx, Vec :: new ( ) )
597- } ) ;
590+ let ( idx, _) = rgen
591+ . entry ( SimplifiedParam :: AssociatedType ( trait_, data. assoc . name ) )
592+ . or_insert_with ( || ( idx, Vec :: new ( ) ) ) ;
598593 Some ( RenderTypeId :: Index ( * idx) )
599594 } else {
600595 None
601596 }
602597 }
603598 // Not supported yet
604- clean:: BareFunction ( _)
605- | clean:: Generic ( _)
606- | clean:: ImplTrait ( _)
607- | clean:: Infer => None ,
599+ clean:: BareFunction ( _) | clean:: Generic ( _) | clean:: ImplTrait ( _) | clean:: Infer => None ,
608600 }
609601}
610602
@@ -853,21 +845,20 @@ fn simplify_fn_type<'tcx, 'a>(
853845 // Self is technically just Iterator, but we want to pretend it's more like this:
854846 //
855847 // fn next<T>(self: Iterator<Item=T>) -> Option<T>
856- if is_self &&
857- let Type :: Path { path } = arg &&
858- let def_id = path. def_id ( ) &&
859- let Some ( trait_) = cache. traits . get ( & def_id) &&
860- trait_. items . iter ( ) . any ( |at| at. is_ty_associated_type ( ) )
848+ if is_self
849+ && let Type :: Path { path } = arg
850+ && let def_id = path. def_id ( )
851+ && let Some ( trait_) = cache. traits . get ( & def_id)
852+ && trait_. items . iter ( ) . any ( |at| at. is_ty_associated_type ( ) )
861853 {
862854 for assoc_ty in & trait_. items {
863- if let clean:: ItemKind :: TyAssocTypeItem ( _generics, bounds) = & * assoc_ty. kind &&
864- let Some ( name) = assoc_ty. name
855+ if let clean:: ItemKind :: TyAssocTypeItem ( _generics, bounds) = & * assoc_ty. kind
856+ && let Some ( name) = assoc_ty. name
865857 {
866858 let idx = -isize:: try_from ( rgen. len ( ) + 1 ) . unwrap ( ) ;
867- let ( idx, stored_bounds) = rgen. entry ( SimplifiedParam :: AssociatedType ( def_id, name) )
868- . or_insert_with ( || {
869- ( idx, Vec :: new ( ) )
870- } ) ;
859+ let ( idx, stored_bounds) = rgen
860+ . entry ( SimplifiedParam :: AssociatedType ( def_id, name) )
861+ . or_insert_with ( || ( idx, Vec :: new ( ) ) ) ;
871862 let idx = * idx;
872863 if stored_bounds. is_empty ( ) {
873864 // Can't just pass stored_bounds to simplify_fn_type,
@@ -890,16 +881,22 @@ fn simplify_fn_type<'tcx, 'a>(
890881 ) ;
891882 }
892883 }
893- let stored_bounds = & mut rgen. get_mut ( & SimplifiedParam :: AssociatedType ( def_id, name) ) . unwrap ( ) . 1 ;
884+ let stored_bounds = & mut rgen
885+ . get_mut ( & SimplifiedParam :: AssociatedType ( def_id, name) )
886+ . unwrap ( )
887+ . 1 ;
894888 if stored_bounds. is_empty ( ) {
895889 * stored_bounds = type_bounds;
896890 }
897891 }
898- ty_bindings. push ( ( RenderTypeId :: AssociatedType ( name) , vec ! [ RenderType {
899- id: Some ( RenderTypeId :: Index ( idx) ) ,
900- generics: None ,
901- bindings: None ,
902- } ] ) )
892+ ty_bindings. push ( (
893+ RenderTypeId :: AssociatedType ( name) ,
894+ vec ! [ RenderType {
895+ id: Some ( RenderTypeId :: Index ( idx) ) ,
896+ generics: None ,
897+ bindings: None ,
898+ } ] ,
899+ ) )
903900 }
904901 }
905902 }
0 commit comments