Skip to content

Commit 3d857ef

Browse files
authored
Use as_deref() to replace as_ref().map(...)
Suggested by @lzutao
1 parent 7785834 commit 3d857ef

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

Diff for: src/librustdoc/html/render.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -2152,7 +2152,7 @@ fn stability_tags(item: &clean::Item) -> String {
21522152
}
21532153

21542154
if let Some(stab) = item.stability.as_ref().filter(|s| s.level == stability::Unstable) {
2155-
if stab.feature.as_ref().map(|s| &**s) == Some("rustc_private") {
2155+
if stab.feature.as_deref() == Some("rustc_private") {
21562156
tags += &tag_html("internal", "Internal");
21572157
} else {
21582158
tags += &tag_html("unstable", "Experimental");
@@ -2205,7 +2205,7 @@ fn short_stability(item: &clean::Item, cx: &Context) -> Vec<String> {
22052205
}
22062206

22072207
if let Some(stab) = item.stability.as_ref().filter(|stab| stab.level == stability::Unstable) {
2208-
let is_rustc_private = stab.feature.as_ref().map(|s| &**s) == Some("rustc_private");
2208+
let is_rustc_private = stab.feature.as_deref() == Some("rustc_private");
22092209

22102210
let mut message = if is_rustc_private {
22112211
"<span class='emoji'>⚙️</span> This is an internal compiler API."
@@ -2214,7 +2214,7 @@ fn short_stability(item: &clean::Item, cx: &Context) -> Vec<String> {
22142214
}
22152215
.to_owned();
22162216

2217-
if let Some(feature) = stab.feature.as_ref() {
2217+
if let Some(feature) = stab.feature.as_deref() {
22182218
let mut feature = format!("<code>{}</code>", Escape(&feature));
22192219
if let (Some(url), Some(issue)) = (&cx.shared.issue_tracker_base_url, stab.issue) {
22202220
feature.push_str(&format!(

0 commit comments

Comments
 (0)