aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_syntax/src/ast
diff options
context:
space:
mode:
authorkjeremy <[email protected]>2019-10-30 20:08:59 +0000
committerkjeremy <[email protected]>2019-10-30 20:08:59 +0000
commit78f93c8033d4803167536a070c2162b072e16055 (patch)
treebc2a50b6af2d38debd3f5fba0e18da4e7cd3a8e8 /crates/ra_syntax/src/ast
parentb205a0ced3f8b2136ac256d8a3dca9fa09e910be (diff)
traits => match_ast!
Diffstat (limited to 'crates/ra_syntax/src/ast')
-rw-r--r--crates/ra_syntax/src/ast/traits.rs12
1 files changed, 7 insertions, 5 deletions
diff --git a/crates/ra_syntax/src/ast/traits.rs b/crates/ra_syntax/src/ast/traits.rs
index 76313684e..c2b005886 100644
--- a/crates/ra_syntax/src/ast/traits.rs
+++ b/crates/ra_syntax/src/ast/traits.rs
@@ -6,6 +6,7 @@ use itertools::Itertools;
6 6
7use crate::{ 7use crate::{
8 ast::{self, child_opt, children, AstChildren, AstNode, AstToken}, 8 ast::{self, child_opt, children, AstChildren, AstNode, AstToken},
9 match_ast,
9 syntax_node::{SyntaxElementChildren, SyntaxNodeChildren}, 10 syntax_node::{SyntaxElementChildren, SyntaxNodeChildren},
10}; 11};
11 12
@@ -68,11 +69,12 @@ impl Iterator for ItemOrMacroIter {
68 fn next(&mut self) -> Option<ItemOrMacro> { 69 fn next(&mut self) -> Option<ItemOrMacro> {
69 loop { 70 loop {
70 let n = self.0.next()?; 71 let n = self.0.next()?;
71 if let Some(item) = ast::ModuleItem::cast(n.clone()) { 72 match_ast! {
72 return Some(ItemOrMacro::Item(item)); 73 match n {
73 } 74 ast::ModuleItem(it) => { return Some(ItemOrMacro::Item(it)) },
74 if let Some(call) = ast::MacroCall::cast(n) { 75 ast::MacroCall(it) => { return Some(ItemOrMacro::Macro(it)) },
75 return Some(ItemOrMacro::Macro(call)); 76 _ => {},
77 }
76 } 78 }
77 } 79 }
78 } 80 }