about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorIvan Tham <pickfire@riseup.net>2020-01-05 23:10:30 +0800
committerGitHub <noreply@github.com>2020-01-05 23:10:30 +0800
commit3d857efb4635dad00a8206a1225e344cd29915c6 (patch)
tree44194ce9e5fc3fb0704cede3ebc7ec8ce233924a /src
parent7785834159030e8d734af31d27bef4acfeabd9f2 (diff)
downloadrust-3d857efb4635dad00a8206a1225e344cd29915c6.tar.gz
rust-3d857efb4635dad00a8206a1225e344cd29915c6.zip
Use `as_deref()` to replace `as_ref().map(...)`
Suggested by @lzutao
Diffstat (limited to 'src')
-rw-r--r--src/librustdoc/html/render.rs6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/librustdoc/html/render.rs b/src/librustdoc/html/render.rs
index c315cefc1b8..85661621fba 100644
--- a/src/librustdoc/html/render.rs
+++ b/src/librustdoc/html/render.rs
@@ -2152,7 +2152,7 @@ fn stability_tags(item: &clean::Item) -> String {
     }
 
     if let Some(stab) = item.stability.as_ref().filter(|s| s.level == stability::Unstable) {
-        if stab.feature.as_ref().map(|s| &**s) == Some("rustc_private") {
+        if stab.feature.as_deref() == Some("rustc_private") {
             tags += &tag_html("internal", "Internal");
         } else {
             tags += &tag_html("unstable", "Experimental");
@@ -2205,7 +2205,7 @@ fn short_stability(item: &clean::Item, cx: &Context) -> Vec<String> {
     }
 
     if let Some(stab) = item.stability.as_ref().filter(|stab| stab.level == stability::Unstable) {
-        let is_rustc_private = stab.feature.as_ref().map(|s| &**s) == Some("rustc_private");
+        let is_rustc_private = stab.feature.as_deref() == Some("rustc_private");
 
         let mut message = if is_rustc_private {
             "<span class='emoji'>⚙️</span> This is an internal compiler API."
@@ -2214,7 +2214,7 @@ fn short_stability(item: &clean::Item, cx: &Context) -> Vec<String> {
         }
         .to_owned();
 
-        if let Some(feature) = stab.feature.as_ref() {
+        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!(