1
Fork 0

Implement boolean lit support in cfg predicates

This commit is contained in:
Urgau 2024-09-19 10:13:14 +02:00
parent 57b9b1f974
commit c99f29b29f
6 changed files with 48 additions and 6 deletions

View file

@ -527,6 +527,16 @@ impl NestedMetaItem {
}
}
/// Returns the `MetaItem` if `self` is a `NestedMetaItem::MetaItem` or if it's
/// `NestedMetaItem::Lit(MetaItemLit { kind: LitKind::Bool(_), .. })`.
pub fn meta_item_or_bool(&self) -> Option<&NestedMetaItem> {
match self {
NestedMetaItem::MetaItem(_item) => Some(self),
NestedMetaItem::Lit(MetaItemLit { kind: LitKind::Bool(_), .. }) => Some(self),
_ => None,
}
}
/// Returns the `MetaItem` if `self` is a `NestedMetaItem::MetaItem`.
pub fn meta_item(&self) -> Option<&MetaItem> {
match self {