@@ -2194,7 +2194,6 @@ fn document(w: &mut fmt::Formatter, cx: &Context, item: &clean::Item) -> fmt::Re
2194
2194
info ! ( "Documenting {}" , name) ;
2195
2195
}
2196
2196
document_stability ( w, cx, item) ?;
2197
- document_non_exhaustive ( w, item) ?;
2198
2197
let prefix = render_assoc_const_value ( item) ;
2199
2198
document_full ( w, item, cx, & prefix) ?;
2200
2199
Ok ( ( ) )
@@ -2263,20 +2262,13 @@ fn document_stability(w: &mut fmt::Formatter, cx: &Context, item: &clean::Item)
2263
2262
Ok ( ( ) )
2264
2263
}
2265
2264
2265
+ fn document_non_exhaustive_header ( item : & clean:: Item ) -> & str {
2266
+ if item. is_non_exhaustive ( ) { " (Non-exhaustive)" } else { "" }
2267
+ }
2268
+
2266
2269
fn document_non_exhaustive ( w : & mut fmt:: Formatter , item : & clean:: Item ) -> fmt:: Result {
2267
2270
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'>" ) ?;
2280
2272
2281
2273
if item. is_struct ( ) {
2282
2274
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
2293
2285
constructors.") ?;
2294
2286
}
2295
2287
2296
- write ! ( w, "</p></details></div></div> " ) ?;
2288
+ write ! ( w, "</p>" ) ?;
2297
2289
}
2298
2290
2299
2291
Ok ( ( ) )
@@ -3159,7 +3151,9 @@ fn item_struct(w: &mut fmt::Formatter, cx: &Context, it: &clean::Item,
3159
3151
if let doctree:: Plain = s. struct_type {
3160
3152
if fields. peek ( ) . is_some ( ) {
3161
3153
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) ?;
3163
3157
for ( field, ty) in fields {
3164
3158
let id = derive_id ( format ! ( "{}.{}" ,
3165
3159
ItemType :: StructField ,
@@ -3291,7 +3285,9 @@ fn item_enum(w: &mut fmt::Formatter, cx: &Context, it: &clean::Item,
3291
3285
document ( w, cx, it) ?;
3292
3286
if !e. variants . is_empty ( ) {
3293
3287
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) ?;
3295
3291
for variant in & e. variants {
3296
3292
let id = derive_id ( format ! ( "{}.{}" ,
3297
3293
ItemType :: Variant ,
@@ -3392,7 +3388,8 @@ const ATTRIBUTE_WHITELIST: &'static [&'static str] = &[
3392
3388
"must_use" ,
3393
3389
"no_mangle" ,
3394
3390
"repr" ,
3395
- "unsafe_destructor_blind_to_params"
3391
+ "unsafe_destructor_blind_to_params" ,
3392
+ "non_exhaustive"
3396
3393
] ;
3397
3394
3398
3395
fn render_attributes ( w : & mut fmt:: Formatter , it : & clean:: Item ) -> fmt:: Result {
0 commit comments