1
Fork 0

Include type in non-exhaustive message. Include new css in dark theme.

This commit is contained in:
David Wood 2018-06-27 23:07:42 +01:00
parent a074bd7334
commit 039709d34f
No known key found for this signature in database
GPG key ID: 01760B4F9F53F154
2 changed files with 6 additions and 4 deletions

View file

@ -2265,21 +2265,22 @@ fn document_stability(w: &mut fmt::Formatter, cx: &Context, item: &clean::Item)
fn document_non_exhaustive(w: &mut fmt::Formatter, item: &clean::Item) -> fmt::Result { fn document_non_exhaustive(w: &mut fmt::Formatter, item: &clean::Item) -> fmt::Result {
if item.non_exhaustive { if item.non_exhaustive {
let name = item.type_();
write!(w, r##" write!(w, r##"
<div class='non-exhaustive'> <div class='non-exhaustive'>
<div class='stab non-exhaustive'> <div class='stab non-exhaustive'>
<details> <details>
<summary> <summary>
<span class=microscope>🔬</span> <span class=microscope>🔬</span>
This type is marked as non exhaustive. This {} is marked as non exhaustive.
</summary> </summary>
<p> <p>
This type will require a wildcard arm in any match statements or constructors. This {} will require a wildcard arm in any match statements or constructors.
</p> </p>
</details> </details>
</div> </div>
</div> </div>
"##)?; "##, name, name)?;
} }
Ok(()) Ok(())

View file

@ -188,6 +188,7 @@ a.test-arrow {
border-color: #008dfd; border-color: #008dfd;
} }
.stab.non-exhaustive { background: #2a2a2a; border-color: #707070; }
.stab.unstable { background: #FFF5D6; border-color: #FFC600; color: #404040; } .stab.unstable { background: #FFF5D6; border-color: #FFC600; color: #404040; }
.stab.deprecated { background: #F3DFFF; border-color: #7F0087; color: #404040; } .stab.deprecated { background: #F3DFFF; border-color: #7F0087; color: #404040; }
.stab.portability { background: #C4ECFF; border-color: #7BA5DB; color: #404040; } .stab.portability { background: #C4ECFF; border-color: #7BA5DB; color: #404040; }
@ -406,4 +407,4 @@ kbd {
} }
.search-results td span.grey { .search-results td span.grey {
color: #ccc; color: #ccc;
} }