aboutsummaryrefslogtreecommitdiff
path: root/crates
diff options
context:
space:
mode:
authorkjeremy <[email protected]>2019-10-30 20:09:16 +0000
committerkjeremy <[email protected]>2019-10-30 20:09:16 +0000
commit4ad37df22339ff91779782d37ab315ef0ce274eb (patch)
tree44a1a89dd39c13ca1dfb111b5a50b20465aa50ac /crates
parent78f93c8033d4803167536a070c2162b072e16055 (diff)
runnables => match_ast!
Diffstat (limited to 'crates')
-rw-r--r--crates/ra_ide_api/src/runnables.rs14
1 files changed, 7 insertions, 7 deletions
diff --git a/crates/ra_ide_api/src/runnables.rs b/crates/ra_ide_api/src/runnables.rs
index 910883da7..1b5c8deea 100644
--- a/crates/ra_ide_api/src/runnables.rs
+++ b/crates/ra_ide_api/src/runnables.rs
@@ -4,7 +4,7 @@ use itertools::Itertools;
4use ra_db::SourceDatabase; 4use ra_db::SourceDatabase;
5use ra_syntax::{ 5use ra_syntax::{
6 ast::{self, AstNode, AttrsOwner, ModuleItemOwner, NameOwner}, 6 ast::{self, AstNode, AttrsOwner, ModuleItemOwner, NameOwner},
7 SyntaxNode, TextRange, 7 match_ast, SyntaxNode, TextRange,
8}; 8};
9 9
10use crate::{db::RootDatabase, FileId}; 10use crate::{db::RootDatabase, FileId};
@@ -29,12 +29,12 @@ pub(crate) fn runnables(db: &RootDatabase, file_id: FileId) -> Vec<Runnable> {
29} 29}
30 30
31fn runnable(db: &RootDatabase, file_id: FileId, item: SyntaxNode) -> Option<Runnable> { 31fn runnable(db: &RootDatabase, file_id: FileId, item: SyntaxNode) -> Option<Runnable> {
32 if let Some(fn_def) = ast::FnDef::cast(item.clone()) { 32 match_ast! {
33 runnable_fn(fn_def) 33 match item {
34 } else if let Some(m) = ast::Module::cast(item) { 34 ast::FnDef(it) => { runnable_fn(it) },
35 runnable_mod(db, file_id, m) 35 ast::Module(it) => { runnable_mod(db, file_id, it) },
36 } else { 36 _ => { None },
37 None 37 }
38 } 38 }
39} 39}
40 40