@@ -2194,7 +2194,6 @@ fn document(w: &mut fmt::Formatter, cx: &Context, item: &clean::Item) -> fmt::Re
21942194 info ! ( "Documenting {}" , name) ;
21952195 }
21962196 document_stability ( w, cx, item) ?;
2197- document_non_exhaustive ( w, item) ?;
21982197 let prefix = render_assoc_const_value ( item) ;
21992198 document_full ( w, item, cx, & prefix) ?;
22002199 Ok ( ( ) )
@@ -2263,20 +2262,13 @@ fn document_stability(w: &mut fmt::Formatter, cx: &Context, item: &clean::Item)
22632262 Ok ( ( ) )
22642263}
22652264
2265+ fn document_non_exhaustive_header ( item : & clean:: Item ) -> & str {
2266+ if item. is_non_exhaustive ( ) { " (Non-exhaustive)" } else { "" }
2267+ }
2268+
22662269fn document_non_exhaustive ( w : & mut fmt:: Formatter , item : & clean:: Item ) -> fmt:: Result {
22672270 if item. is_non_exhaustive ( ) {
2268- write ! ( w, "<div class='non-exhaustive'><div class='stab non-exhaustive'>" ) ?;
2269- write ! ( w, "<details><summary><span class=microscope>🔬</span>" ) ?;
2270-
2271- if item. is_struct ( ) {
2272- write ! ( w, "This struct is marked as non exhaustive." ) ?;
2273- } else if item. is_enum ( ) {
2274- write ! ( w, "This enum is marked as non exhaustive." ) ?;
2275- } else {
2276- write ! ( w, "This type is marked as non exhaustive." ) ?;
2277- }
2278-
2279- write ! ( w, "</summary><p>" ) ?;
2271+ write ! ( w, "<p class='non-exhaustive'>" ) ?;
22802272
22812273 if item. is_struct ( ) {
22822274 write ! ( w, "This struct is marked as non-exhaustive as additional fields may be \
@@ -2293,7 +2285,7 @@ fn document_non_exhaustive(w: &mut fmt::Formatter, item: &clean::Item) -> fmt::R
22932285 constructors.") ?;
22942286 }
22952287
2296- write ! ( w, "</p></details></div></div> " ) ?;
2288+ write ! ( w, "</p>" ) ?;
22972289 }
22982290
22992291 Ok ( ( ) )
@@ -3159,7 +3151,9 @@ fn item_struct(w: &mut fmt::Formatter, cx: &Context, it: &clean::Item,
31593151 if let doctree:: Plain = s. struct_type {
31603152 if fields. peek ( ) . is_some ( ) {
31613153 write ! ( w, "<h2 id='fields' class='fields small-section-header'>
3162- Fields<a href='#fields' class='anchor'></a></h2>" ) ?;
3154+ Fields{}<a href='#fields' class='anchor'></a></h2>" ,
3155+ document_non_exhaustive_header( it) ) ?;
3156+ document_non_exhaustive ( w, it) ?;
31633157 for ( field, ty) in fields {
31643158 let id = derive_id ( format ! ( "{}.{}" ,
31653159 ItemType :: StructField ,
@@ -3291,7 +3285,9 @@ fn item_enum(w: &mut fmt::Formatter, cx: &Context, it: &clean::Item,
32913285 document ( w, cx, it) ?;
32923286 if !e. variants . is_empty ( ) {
32933287 write ! ( w, "<h2 id='variants' class='variants small-section-header'>
3294- Variants<a href='#variants' class='anchor'></a></h2>\n " ) ?;
3288+ Variants{}<a href='#variants' class='anchor'></a></h2>\n " ,
3289+ document_non_exhaustive_header( it) ) ?;
3290+ document_non_exhaustive ( w, it) ?;
32953291 for variant in & e. variants {
32963292 let id = derive_id ( format ! ( "{}.{}" ,
32973293 ItemType :: Variant ,
@@ -3392,7 +3388,8 @@ const ATTRIBUTE_WHITELIST: &'static [&'static str] = &[
33923388 "must_use" ,
33933389 "no_mangle" ,
33943390 "repr" ,
3395- "unsafe_destructor_blind_to_params"
3391+ "unsafe_destructor_blind_to_params" ,
3392+ "non_exhaustive"
33963393] ;
33973394
33983395fn render_attributes ( w : & mut fmt:: Formatter , it : & clean:: Item ) -> fmt:: Result {
0 commit comments