diff options
author | bors[bot] <bors[bot]@users.noreply.github.com> | 2019-01-08 09:05:55 +0000 |
---|---|---|
committer | bors[bot] <bors[bot]@users.noreply.github.com> | 2019-01-08 09:05:55 +0000 |
commit | 3f4be819125ce4a22edd86721fa56b5caba99c2e (patch) | |
tree | be93895ddc08c911585d9f7bc64623a3741f32c6 /crates/ra_analysis/src/runnables.rs | |
parent | 4e444d2bc24d16284401444fd2154f63e0f96070 (diff) | |
parent | 122410d7aa34a32d468a3173858cbc8a2bbc68f5 (diff) |
Merge #449
449: switch to new rowan API r=matklad a=matklad
closes https://github.com/rust-analyzer/rust-analyzer/issues/448
Co-authored-by: Aleksey Kladov <[email protected]>
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")); |