diff options
| author | Nicholas Nethercote <n.nethercote@gmail.com> | 2024-04-24 14:25:59 +1000 |
|---|---|---|
| committer | Nicholas Nethercote <n.nethercote@gmail.com> | 2024-04-24 16:28:34 +1000 |
| commit | 8d4655d9ec9befc5cdcbb8d7a2961a75aecfc145 (patch) | |
| tree | c210a771356b687af4caf3c6671cf92f8215788b /compiler/rustc_ast/src | |
| parent | d5ec9b458a4a584164cbfc6a53298560091ecd8c (diff) | |
| download | rust-8d4655d9ec9befc5cdcbb8d7a2961a75aecfc145.tar.gz rust-8d4655d9ec9befc5cdcbb8d7a2961a75aecfc145.zip | |
Rename `NestedMetaItem::name_value_literal`.
It's a highly misleading name, because it's completely different to `MetaItem::name_value_literal`. Specifically, it doesn't match `MetaItemKind::NameValue` (e.g. `#[foo = 3]`), it matches `MetaItemKind::List` (e.g. `#[foo(3)]`).
Diffstat (limited to 'compiler/rustc_ast/src')
| -rw-r--r-- | compiler/rustc_ast/src/attr/mod.rs | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/compiler/rustc_ast/src/attr/mod.rs b/compiler/rustc_ast/src/attr/mod.rs index e67c5fd9a5a..0f12fd31975 100644 --- a/compiler/rustc_ast/src/attr/mod.rs +++ b/compiler/rustc_ast/src/attr/mod.rs @@ -464,8 +464,9 @@ impl NestedMetaItem { self.meta_item().and_then(|meta_item| meta_item.meta_item_list()) } - /// Returns a name and single literal value tuple of the `MetaItem`. - pub fn name_value_literal(&self) -> Option<(Symbol, &MetaItemLit)> { + /// If it's a singleton list of the form `foo(lit)`, returns the `foo` and + /// the `lit`. + pub fn singleton_lit_list(&self) -> Option<(Symbol, &MetaItemLit)> { self.meta_item().and_then(|meta_item| { meta_item.meta_item_list().and_then(|meta_item_list| { if meta_item_list.len() == 1 |
