mirror of
https://github.com/rust-lang/rust-analyzer
synced 2025-01-13 13:48:50 +00:00
traits => match_ast!
This commit is contained in:
parent
b205a0ced3
commit
78f93c8033
1 changed files with 7 additions and 5 deletions
|
@ -6,6 +6,7 @@ use itertools::Itertools;
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
ast::{self, child_opt, children, AstChildren, AstNode, AstToken},
|
ast::{self, child_opt, children, AstChildren, AstNode, AstToken},
|
||||||
|
match_ast,
|
||||||
syntax_node::{SyntaxElementChildren, SyntaxNodeChildren},
|
syntax_node::{SyntaxElementChildren, SyntaxNodeChildren},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -68,11 +69,12 @@ impl Iterator for ItemOrMacroIter {
|
||||||
fn next(&mut self) -> Option<ItemOrMacro> {
|
fn next(&mut self) -> Option<ItemOrMacro> {
|
||||||
loop {
|
loop {
|
||||||
let n = self.0.next()?;
|
let n = self.0.next()?;
|
||||||
if let Some(item) = ast::ModuleItem::cast(n.clone()) {
|
match_ast! {
|
||||||
return Some(ItemOrMacro::Item(item));
|
match n {
|
||||||
}
|
ast::ModuleItem(it) => { return Some(ItemOrMacro::Item(it)) },
|
||||||
if let Some(call) = ast::MacroCall::cast(n) {
|
ast::MacroCall(it) => { return Some(ItemOrMacro::Macro(it)) },
|
||||||
return Some(ItemOrMacro::Macro(call));
|
_ => {},
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue