diff options
| author | Nicholas Nethercote <n.nethercote@gmail.com> | 2025-03-26 13:23:13 +1100 |
|---|---|---|
| committer | Nicholas Nethercote <n.nethercote@gmail.com> | 2025-04-01 07:34:23 +1100 |
| commit | 9fb0defa520c82ccf79af7961ee926dba77b4e96 (patch) | |
| tree | a6f52626027638c78a941f7342b3fb4cb9c0f093 | |
| parent | a6a6d01bbc93da72474983d355e7442abbd162e8 (diff) | |
| download | rust-9fb0defa520c82ccf79af7961ee926dba77b4e96.tar.gz rust-9fb0defa520c82ccf79af7961ee926dba77b4e96.zip | |
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".
| -rw-r--r-- | compiler/rustc_passes/src/check_attr.rs | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/compiler/rustc_passes/src/check_attr.rs b/compiler/rustc_passes/src/check_attr.rs index ada3151c3b8..3019c5c0dae 100644 --- a/compiler/rustc_passes/src/check_attr.rs +++ b/compiler/rustc_passes/src/check_attr.rs @@ -1041,11 +1041,11 @@ impl<'tcx> CheckAttrVisitor<'tcx> { s <= kw::Union || s == sym::SelfTy } - let doc_keyword = meta.value_str().unwrap_or(kw::Empty); - if doc_keyword == kw::Empty { - self.doc_attr_str_error(meta, "keyword"); - return; - } + let doc_keyword = match meta.value_str() { + Some(value) if value != kw::Empty => value, + _ => return self.doc_attr_str_error(meta, "keyword"), + }; + let item_kind = match self.tcx.hir_node(hir_id) { hir::Node::Item(item) => Some(&item.kind), _ => None, |
