rustdoc: tweak `some variants omitted`

Don't display `// some variants omitted` if enum is marked
`#[non_exhaustive]`
This commit is contained in:
Ezra Shaw 2023-03-11 21:22:42 +13:00
parent 0c61c7a978
commit e0ec9c0b9c
No known key found for this signature in database
GPG Key ID: 67ABF16FB0ECD870
2 changed files with 12 additions and 1 deletions

View File

@ -1234,7 +1234,7 @@ fn item_enum(w: &mut Buffer, cx: &mut Context<'_>, it: &clean::Item, e: &clean::
w.write_str(",\n");
}
if variants_stripped {
if variants_stripped && !it.is_non_exhaustive() {
w.write_str(" // some variants omitted\n");
}
if toggle {

View File

@ -0,0 +1,11 @@
// @has issue_108925/enum.MyThing.html
// @has - '//code' 'Shown'
// @!has - '//code' 'NotShown'
// @!has - '//code' '// some variants omitted'
#[non_exhaustive]
pub enum MyThing {
Shown,
#[doc(hidden)]
NotShown,
}