Skip to content

Commit e306244

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 0ed6c61 commit e306244

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

compiler/rustc_passes/src/check_attr.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1024,11 +1024,11 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
10241024
s <= kw::Union || s == sym::SelfTy
10251025
}
10261026

1027-
let doc_keyword = meta.value_str().unwrap_or(kw::Empty);
1028-
if doc_keyword == kw::Empty {
1029-
self.doc_attr_str_error(meta, "keyword");
1030-
return;
1031-
}
1027+
let doc_keyword = match meta.value_str() {
1028+
Some(value) if value != kw::Empty => value,
1029+
_ => return self.doc_attr_str_error(meta, "keyword"),
1030+
};
1031+
10321032
let item_kind = match self.tcx.hir_node(hir_id) {
10331033
hir::Node::Item(item) => Some(&item.kind),
10341034
_ => None,

0 commit comments

Comments
 (0)