diff options
| author | Nicholas Nethercote <n.nethercote@gmail.com> | 2024-04-24 13:18:17 +1000 |
|---|---|---|
| committer | Nicholas Nethercote <n.nethercote@gmail.com> | 2024-04-24 16:28:34 +1000 |
| commit | d5ec9b458a4a584164cbfc6a53298560091ecd8c (patch) | |
| tree | b4a302ac6fabc1772061a42ed273689c4b4499de | |
| parent | 15e71b6e43e28ffaa9db70c39fdf82be062e5cfd (diff) | |
| download | rust-d5ec9b458a4a584164cbfc6a53298560091ecd8c.tar.gz rust-d5ec9b458a4a584164cbfc6a53298560091ecd8c.zip | |
Remove `MetaItemKind::value_str`.
`MetaItem::value_str` is good enough. And this makes `MetaItem::value_str` more like `MetaItem::meta_item_list` and `name_value_literal`.
| -rw-r--r-- | compiler/rustc_ast/src/attr/mod.rs | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/compiler/rustc_ast/src/attr/mod.rs b/compiler/rustc_ast/src/attr/mod.rs index 5e3fc7e3357..e67c5fd9a5a 100644 --- a/compiler/rustc_ast/src/attr/mod.rs +++ b/compiler/rustc_ast/src/attr/mod.rs @@ -298,7 +298,10 @@ impl MetaItem { } pub fn value_str(&self) -> Option<Symbol> { - self.kind.value_str() + match &self.kind { + MetaItemKind::NameValue(v) => v.kind.str(), + _ => None, + } } fn from_tokens<'a, I>(tokens: &mut iter::Peekable<I>) -> Option<MetaItem> @@ -362,13 +365,6 @@ impl MetaItem { } impl MetaItemKind { - pub fn value_str(&self) -> Option<Symbol> { - match self { - MetaItemKind::NameValue(v) => v.kind.str(), - _ => None, - } - } - fn list_from_tokens(tokens: TokenStream) -> Option<ThinVec<NestedMetaItem>> { let mut tokens = tokens.trees().peekable(); let mut result = ThinVec::new(); |
