crate trait NestedAttributesExt {
/// Returns `true` if the attribute list contains a specific `Word`
fn has_word(self, word: Symbol) -> bool;
- fn get_word_attr(self, word: Symbol) -> (Option<ast::NestedMetaItem>, bool);
+ fn get_word_attr(self, word: Symbol) -> Option<ast::NestedMetaItem>;
}
impl<I: Iterator<Item = ast::NestedMetaItem> + IntoIterator<Item = ast::NestedMetaItem>>
self.into_iter().any(|attr| attr.is_word() && attr.has_name(word))
}
- fn get_word_attr(mut self, word: Symbol) -> (Option<ast::NestedMetaItem>, bool) {
- match self.find(|attr| attr.is_word() && attr.has_name(word)) {
- Some(a) => (Some(a), true),
- None => (None, false),
- }
+ fn get_word_attr(mut self, word: Symbol) -> Option<ast::NestedMetaItem> {
+ self.find(|attr| attr.is_word() && attr.has_name(word))
}
}