Skip to content

Commit 9fb0def

Browse files
committed
Tweak check_doc_keyword.
To use one `kw::Empty` instead of two. It's a little more direct this way, and avoids `kw::Empty` being used for both "no string" and "empty string".
1 parent a6a6d01 commit 9fb0def

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

compiler/rustc_passes/src/check_attr.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -1041,11 +1041,11 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
10411041
s <= kw::Union || s == sym::SelfTy
10421042
}
10431043

1044-
let doc_keyword = meta.value_str().unwrap_or(kw::Empty);
1045-
if doc_keyword == kw::Empty {
1046-
self.doc_attr_str_error(meta, "keyword");
1047-
return;
1048-
}
1044+
let doc_keyword = match meta.value_str() {
1045+
Some(value) if value != kw::Empty => value,
1046+
_ => return self.doc_attr_str_error(meta, "keyword"),
1047+
};
1048+
10491049
let item_kind = match self.tcx.hir_node(hir_id) {
10501050
hir::Node::Item(item) => Some(&item.kind),
10511051
_ => None,

0 commit comments

Comments
 (0)