diff options
-rw-r--r-- | crates/ra_ide_api/src/runnables.rs | 14 |
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; | |||
4 | use ra_db::SourceDatabase; | 4 | use ra_db::SourceDatabase; |
5 | use ra_syntax::{ | 5 | use 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 | ||
10 | use crate::{db::RootDatabase, FileId}; | 10 | use crate::{db::RootDatabase, FileId}; |
@@ -29,12 +29,12 @@ pub(crate) fn runnables(db: &RootDatabase, file_id: FileId) -> Vec<Runnable> { | |||
29 | } | 29 | } |
30 | 30 | ||
31 | fn runnable(db: &RootDatabase, file_id: FileId, item: SyntaxNode) -> Option<Runnable> { | 31 | fn 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 | ||