@@ -282,11 +282,34 @@ fn item_module(w: &mut Buffer, cx: &Context<'_>, item: &clean::Item, items: &[cl
282
282
}
283
283
284
284
clean:: ImportItem ( ref import) => {
285
+ let ( stab, stab_tags) = if let ( Some ( def_id) , Some ( attrs) ) =
286
+ ( import. source . did , import. source . attrs . clone ( ) )
287
+ {
288
+ let attrs = Box :: new ( attrs) ;
289
+
290
+ // Just need an item with the correct def_id and attrs
291
+ let import_item = clean:: Item { def_id, attrs, ..myitem. clone ( ) } ;
292
+
293
+ let stab = import_item. stability_class ( cx. tcx ( ) ) ;
294
+ let stab_tags = Some ( extra_info_tags ( & import_item, item, cx. tcx ( ) ) ) ;
295
+ ( stab, stab_tags)
296
+ } else {
297
+ ( None , None )
298
+ } ;
299
+
300
+ let add = if stab. is_some ( ) { " " } else { "" } ;
301
+
285
302
write ! (
286
303
w,
287
- "<tr><td><code>{}{}</code></td></tr>" ,
288
- myitem. visibility. print_with_space( myitem. def_id, cx) ,
289
- import. print( cx) ,
304
+ "<tr class=\" {stab}{add}import-item\" >\
305
+ <td><code>{vis}{imp}</code></td>\
306
+ <td class=\" docblock-short\" >{stab_tags}</td>\
307
+ </tr>",
308
+ stab = stab. unwrap_or_default( ) ,
309
+ add = add,
310
+ vis = myitem. visibility. print_with_space( myitem. def_id, cx) ,
311
+ imp = import. print( cx) ,
312
+ stab_tags = stab_tags. unwrap_or_default( ) ,
290
313
) ;
291
314
}
292
315
@@ -320,7 +343,7 @@ fn item_module(w: &mut Buffer, cx: &Context<'_>, item: &clean::Item, items: &[cl
320
343
docs = MarkdownSummaryLine ( & doc_value, & myitem. links( cx) ) . into_string( ) ,
321
344
class = myitem. type_( ) ,
322
345
add = add,
323
- stab = stab. unwrap_or_else ( String :: new ) ,
346
+ stab = stab. unwrap_or_default ( ) ,
324
347
unsafety_flag = unsafety_flag,
325
348
href = item_path( myitem. type_( ) , & myitem. name. unwrap( ) . as_str( ) ) ,
326
349
title = [ full_path( cx, myitem) , myitem. type_( ) . to_string( ) ]
0 commit comments