Avoid code duplication in {MetaItem,MetaItemKind}::value_str
.
The two methods are almost identical.
This commit is contained in:
parent
40336865fe
commit
7d1e5a485c
@ -182,13 +182,7 @@ impl MetaItem {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub fn value_str(&self) -> Option<Symbol> {
|
pub fn value_str(&self) -> Option<Symbol> {
|
||||||
match self.kind {
|
self.kind.value_str()
|
||||||
MetaItemKind::NameValue(ref v) => match v.kind {
|
|
||||||
LitKind::Str(ref s, _) => Some(*s),
|
|
||||||
_ => None,
|
|
||||||
},
|
|
||||||
_ => None,
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn meta_item_list(&self) -> Option<&[NestedMetaItem]> {
|
pub fn meta_item_list(&self) -> Option<&[NestedMetaItem]> {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user