Avoid code duplication in {MetaItem,MetaItemKind}::value_str.

The two methods are almost identical.
This commit is contained in:
Nicholas Nethercote 2022-08-01 16:32:42 +10:00
parent 40336865fe
commit 7d1e5a485c

View File

@ -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]> {