@@ -2086,6 +2086,7 @@ fn render_impl(
20862086 . split_summary_and_content ( )
20872087 } )
20882088 . unwrap_or ( ( None , None ) ) ;
2089+
20892090 write ! (
20902091 w,
20912092 "{}" ,
@@ -2097,24 +2098,19 @@ fn render_impl(
20972098 use_absolute,
20982099 aliases,
20992100 before_dox. as_deref( ) ,
2101+ trait_. is_none( ) && impl_. items. is_empty( ) ,
21002102 )
21012103 ) ?;
21022104 if toggled {
21032105 w. write_str ( "</summary>" ) ?;
21042106 }
21052107
2106- if before_dox. is_some ( ) {
2107- if trait_. is_none ( ) && impl_. items . is_empty ( ) {
2108- w. write_str (
2109- "<div class=\" item-info\" >\
2110- <div class=\" stab empty-impl\" >This impl block contains no items.</div>\
2111- </div>",
2112- ) ?;
2113- }
2114- if let Some ( after_dox) = after_dox {
2115- write ! ( w, "<div class=\" docblock\" >{after_dox}</div>" ) ?;
2116- }
2108+ if before_dox. is_some ( )
2109+ && let Some ( after_dox) = after_dox
2110+ {
2111+ write ! ( w, "<div class=\" docblock\" >{after_dox}</div>" ) ?;
21172112 }
2113+
21182114 if !default_impl_items. is_empty ( ) || !impl_items. is_empty ( ) {
21192115 w. write_str ( "<div class=\" impl-items\" >" ) ?;
21202116 close_tags. push ( "</div>" ) ;
@@ -2182,6 +2178,7 @@ fn render_impl_summary(
21822178 // in documentation pages for trait with automatic implementations like "Send" and "Sync".
21832179 aliases : & [ String ] ,
21842180 doc : Option < & str > ,
2181+ impl_is_empty : bool ,
21852182) -> impl fmt:: Display {
21862183 fmt:: from_fn ( move |w| {
21872184 let inner_impl = i. inner_impl ( ) ;
@@ -2237,6 +2234,13 @@ fn render_impl_summary(
22372234 }
22382235
22392236 if let Some ( doc) = doc {
2237+ if impl_is_empty {
2238+ w. write_str (
2239+ "<div class=\" item-info\" >\
2240+ <div class=\" stab empty-impl\" >This impl block contains no items.</div>\
2241+ </div>",
2242+ ) ?;
2243+ }
22402244 write ! ( w, "<div class=\" docblock\" >{doc}</div>" ) ?;
22412245 }
22422246
0 commit comments