1
Fork 0

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".
This commit is contained in:
Nicholas Nethercote 2025-03-26 13:23:13 +11:00
parent a6a6d01bbc
commit 9fb0defa52

View file

@ -1041,11 +1041,11 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
s <= kw::Union || s == sym::SelfTy s <= kw::Union || s == sym::SelfTy
} }
let doc_keyword = meta.value_str().unwrap_or(kw::Empty); let doc_keyword = match meta.value_str() {
if doc_keyword == kw::Empty { Some(value) if value != kw::Empty => value,
self.doc_attr_str_error(meta, "keyword"); _ => return self.doc_attr_str_error(meta, "keyword"),
return; };
}
let item_kind = match self.tcx.hir_node(hir_id) { let item_kind = match self.tcx.hir_node(hir_id) {
hir::Node::Item(item) => Some(&item.kind), hir::Node::Item(item) => Some(&item.kind),
_ => None, _ => None,