diff options
| author | Tyler Mandry <tmandry@gmail.com> | 2020-08-11 12:28:32 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-08-11 12:28:32 -0700 |
| commit | c18b64c8662598b63d3e5f8f654ba3cb4ebcd262 (patch) | |
| tree | a33c7a92946c23be328d2b4b983a46d7323be030 /src/librustdoc/html/render | |
| parent | dcccb47cb80c2038a162ecadc1dd095d1e491961 (diff) | |
| parent | 6bbf4558ac096b6f2cc7cef3920681b8c42e13ef (diff) | |
| download | rust-c18b64c8662598b63d3e5f8f654ba3cb4ebcd262.tar.gz rust-c18b64c8662598b63d3e5f8f654ba3cb4ebcd262.zip | |
Rollup merge of #75378 - petrochenkov:isident, r=Mark-Simulacrum
Introduce `rustc_lexer::is_ident` and use it in couple of places Implements the suggestion from https://github.com/rust-lang/rust/pull/74537#issuecomment-662261979.
Diffstat (limited to 'src/librustdoc/html/render')
| -rw-r--r-- | src/librustdoc/html/render/mod.rs | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/src/librustdoc/html/render/mod.rs b/src/librustdoc/html/render/mod.rs index 36357539692..bd919205dd1 100644 --- a/src/librustdoc/html/render/mod.rs +++ b/src/librustdoc/html/render/mod.rs @@ -2144,7 +2144,7 @@ fn stability_tags(item: &clean::Item) -> String { if item .stability .as_ref() - .map(|s| s.level == stability::Unstable && s.feature.as_deref() != Some("rustc_private")) + .map(|s| s.level == stability::Unstable && s.feature != "rustc_private") == Some(true) { tags += &tag_html("unstable", "Experimental"); @@ -2195,25 +2195,25 @@ fn short_stability(item: &clean::Item, cx: &Context) -> Vec<String> { // Render unstable items. But don't render "rustc_private" crates (internal compiler crates). // Those crates are permanently unstable so it makes no sense to render "unstable" everywhere. - if let Some(stab) = item.stability.as_ref().filter(|stab| { - stab.level == stability::Unstable && stab.feature.as_deref() != Some("rustc_private") - }) { + if let Some(stab) = item + .stability + .as_ref() + .filter(|stab| stab.level == stability::Unstable && stab.feature != "rustc_private") + { let mut message = "<span class='emoji'>🔬</span> This is a nightly-only experimental API.".to_owned(); - if let Some(feature) = stab.feature.as_deref() { - let mut feature = format!("<code>{}</code>", Escape(&feature)); - if let (Some(url), Some(issue)) = (&cx.shared.issue_tracker_base_url, stab.issue) { - feature.push_str(&format!( - " <a href=\"{url}{issue}\">#{issue}</a>", - url = url, - issue = issue - )); - } - - message.push_str(&format!(" ({})", feature)); + let mut feature = format!("<code>{}</code>", Escape(&stab.feature)); + if let (Some(url), Some(issue)) = (&cx.shared.issue_tracker_base_url, stab.issue) { + feature.push_str(&format!( + " <a href=\"{url}{issue}\">#{issue}</a>", + url = url, + issue = issue + )); } + message.push_str(&format!(" ({})", feature)); + if let Some(unstable_reason) = &stab.unstable_reason { let mut ids = cx.id_map.borrow_mut(); message = format!( |
