Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Avoid code duplication in {MetaItem,MetaItemKind}::value_str.
The two methods are almost identical.
  • Loading branch information
nnethercote committed Aug 16, 2022
commit 7d1e5a485c669aedc953e958b780877f0d934ae8
8 changes: 1 addition & 7 deletions compiler/rustc_ast/src/attr/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -182,13 +182,7 @@ impl MetaItem {
}

pub fn value_str(&self) -> Option<Symbol> {
match self.kind {
MetaItemKind::NameValue(ref v) => match v.kind {
LitKind::Str(ref s, _) => Some(*s),
_ => None,
},
_ => None,
}
self.kind.value_str()
}

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