@@ -223,17 +223,16 @@ impl<'a, 'tcx> DocFolder for CacheBuilder<'a, 'tcx> {
223223
224224 // If the impl is from a masked crate or references something from a
225225 // masked crate then remove it completely.
226- if let clean:: ImplItem ( ref i) = * item. kind {
227- if self . cache . masked_crates . contains ( & item. item_id . krate ( ) )
226+ if let clean:: ImplItem ( ref i) = * item. kind &&
227+ ( self . cache . masked_crates . contains ( & item. item_id . krate ( ) )
228228 || i. trait_
229229 . as_ref ( )
230230 . map_or ( false , |t| self . cache . masked_crates . contains ( & t. def_id ( ) . krate ) )
231231 || i. for_
232232 . def_id ( self . cache )
233- . map_or ( false , |d| self . cache . masked_crates . contains ( & d. krate ) )
234- {
235- return None ;
236- }
233+ . map_or ( false , |d| self . cache . masked_crates . contains ( & d. krate ) ) )
234+ {
235+ return None ;
237236 }
238237
239238 // Propagate a trait method's documentation to all implementors of the
@@ -334,33 +333,32 @@ impl<'a, 'tcx> DocFolder for CacheBuilder<'a, 'tcx> {
334333 // A crate has a module at its root, containing all items,
335334 // which should not be indexed. The crate-item itself is
336335 // inserted later on when serializing the search-index.
337- if item. item_id . as_def_id ( ) . map_or ( false , |idx| !idx. is_crate_root ( ) ) {
336+ if item. item_id . as_def_id ( ) . map_or ( false , |idx| !idx. is_crate_root ( ) )
337+ && let ty = item. type_ ( )
338+ && ( ty != ItemType :: StructField
339+ || u16:: from_str_radix ( s. as_str ( ) , 10 ) . is_err ( ) )
340+ {
338341 let desc =
339342 short_markdown_summary ( & item. doc_value ( ) , & item. link_names ( self . cache ) ) ;
340- let ty = item. type_ ( ) ;
341- if ty != ItemType :: StructField
342- || u16:: from_str_radix ( s. as_str ( ) , 10 ) . is_err ( )
343- {
344- // In case this is a field from a tuple struct, we don't add it into
345- // the search index because its name is something like "0", which is
346- // not useful for rustdoc search.
347- self . cache . search_index . push ( IndexItem {
348- ty,
349- name : s,
350- path : join_with_double_colon ( path) ,
351- desc,
352- parent,
353- parent_idx : None ,
354- search_type : get_function_type_for_search (
355- & item,
356- self . tcx ,
357- clean_impl_generics ( self . cache . parent_stack . last ( ) ) . as_ref ( ) ,
358- self . cache ,
359- ) ,
360- aliases : item. attrs . get_doc_aliases ( ) ,
361- deprecation : item. deprecation ( self . tcx ) ,
362- } ) ;
363- }
343+ // In case this is a field from a tuple struct, we don't add it into
344+ // the search index because its name is something like "0", which is
345+ // not useful for rustdoc search.
346+ self . cache . search_index . push ( IndexItem {
347+ ty,
348+ name : s,
349+ path : join_with_double_colon ( path) ,
350+ desc,
351+ parent,
352+ parent_idx : None ,
353+ search_type : get_function_type_for_search (
354+ & item,
355+ self . tcx ,
356+ clean_impl_generics ( self . cache . parent_stack . last ( ) ) . as_ref ( ) ,
357+ self . cache ,
358+ ) ,
359+ aliases : item. attrs . get_doc_aliases ( ) ,
360+ deprecation : item. deprecation ( self . tcx ) ,
361+ } ) ;
364362 }
365363 }
366364 ( Some ( parent) , None ) if is_inherent_impl_item => {
0 commit comments