Skip to content

Commit 7d1e5a4

Browse files
committed
Avoid code duplication in {MetaItem,MetaItemKind}::value_str.
The two methods are almost identical.
1 parent 4033686 commit 7d1e5a4

File tree

1 file changed

+1
-7
lines changed
  • compiler/rustc_ast/src/attr

1 file changed

+1
-7
lines changed

compiler/rustc_ast/src/attr/mod.rs

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -182,13 +182,7 @@ impl MetaItem {
182182
}
183183

184184
pub fn value_str(&self) -> Option<Symbol> {
185-
match self.kind {
186-
MetaItemKind::NameValue(ref v) => match v.kind {
187-
LitKind::Str(ref s, _) => Some(*s),
188-
_ => None,
189-
},
190-
_ => None,
191-
}
185+
self.kind.value_str()
192186
}
193187

194188
pub fn meta_item_list(&self) -> Option<&[NestedMetaItem]> {

0 commit comments

Comments
 (0)