diff options
Diffstat (limited to 'crates/ra_analysis/src/runnables.rs')
-rw-r--r-- | crates/ra_analysis/src/runnables.rs | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/crates/ra_analysis/src/runnables.rs b/crates/ra_analysis/src/runnables.rs index 216209098..98b1d2d55 100644 --- a/crates/ra_analysis/src/runnables.rs +++ b/crates/ra_analysis/src/runnables.rs | |||
@@ -1,7 +1,7 @@ | |||
1 | use itertools::Itertools; | 1 | use itertools::Itertools; |
2 | use ra_syntax::{ | 2 | use ra_syntax::{ |
3 | TextRange, SyntaxNode, | ||
3 | ast::{self, AstNode, NameOwner, ModuleItemOwner}, | 4 | ast::{self, AstNode, NameOwner, ModuleItemOwner}, |
4 | TextRange, SyntaxNodeRef, | ||
5 | }; | 5 | }; |
6 | use ra_db::{Cancelable, SyntaxDatabase}; | 6 | use ra_db::{Cancelable, SyntaxDatabase}; |
7 | 7 | ||
@@ -30,7 +30,7 @@ pub(crate) fn runnables(db: &RootDatabase, file_id: FileId) -> Cancelable<Vec<Ru | |||
30 | Ok(res) | 30 | Ok(res) |
31 | } | 31 | } |
32 | 32 | ||
33 | fn runnable(db: &RootDatabase, file_id: FileId, item: SyntaxNodeRef) -> Option<Runnable> { | 33 | fn runnable(db: &RootDatabase, file_id: FileId, item: &SyntaxNode) -> Option<Runnable> { |
34 | if let Some(fn_def) = ast::FnDef::cast(item) { | 34 | if let Some(fn_def) = ast::FnDef::cast(item) { |
35 | runnable_fn(fn_def) | 35 | runnable_fn(fn_def) |
36 | } else if let Some(m) = ast::Module::cast(item) { | 36 | } else if let Some(m) = ast::Module::cast(item) { |
@@ -40,7 +40,7 @@ fn runnable(db: &RootDatabase, file_id: FileId, item: SyntaxNodeRef) -> Option<R | |||
40 | } | 40 | } |
41 | } | 41 | } |
42 | 42 | ||
43 | fn runnable_fn(fn_def: ast::FnDef) -> Option<Runnable> { | 43 | fn runnable_fn(fn_def: &ast::FnDef) -> Option<Runnable> { |
44 | let name = fn_def.name()?.text(); | 44 | let name = fn_def.name()?.text(); |
45 | let kind = if name == "main" { | 45 | let kind = if name == "main" { |
46 | RunnableKind::Bin | 46 | RunnableKind::Bin |
@@ -57,12 +57,12 @@ fn runnable_fn(fn_def: ast::FnDef) -> Option<Runnable> { | |||
57 | }) | 57 | }) |
58 | } | 58 | } |
59 | 59 | ||
60 | fn runnable_mod(db: &RootDatabase, file_id: FileId, module: ast::Module) -> Option<Runnable> { | 60 | fn runnable_mod(db: &RootDatabase, file_id: FileId, module: &ast::Module) -> Option<Runnable> { |
61 | let has_test_function = module | 61 | let has_test_function = module |
62 | .item_list()? | 62 | .item_list()? |
63 | .items() | 63 | .items() |
64 | .filter_map(|it| match it { | 64 | .filter_map(|it| match it.kind() { |
65 | ast::ModuleItem::FnDef(it) => Some(it), | 65 | ast::ModuleItemKind::FnDef(it) => Some(it), |
66 | _ => None, | 66 | _ => None, |
67 | }) | 67 | }) |
68 | .any(|f| f.has_atom_attr("test")); | 68 | .any(|f| f.has_atom_attr("test")); |