diff options
author | Aleksey Kladov <[email protected]> | 2019-07-19 10:56:47 +0100 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2019-07-19 11:16:25 +0100 |
commit | f1abc7bdc63fedd5a699b4c495bb23f1b6d254f9 (patch) | |
tree | 9518c43f5ddeaa38426efddc17be19af5381f003 /crates/ra_ide_api/src/runnables.rs | |
parent | 0343c4a815a0e82d5e55e76a01d21b0f7a00ff5b (diff) |
migrate ra_ide_api to the new rowan
Diffstat (limited to 'crates/ra_ide_api/src/runnables.rs')
-rw-r--r-- | crates/ra_ide_api/src/runnables.rs | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/crates/ra_ide_api/src/runnables.rs b/crates/ra_ide_api/src/runnables.rs index 8cb859b37..200958434 100644 --- a/crates/ra_ide_api/src/runnables.rs +++ b/crates/ra_ide_api/src/runnables.rs | |||
@@ -26,8 +26,8 @@ pub(crate) fn runnables(db: &RootDatabase, file_id: FileId) -> Vec<Runnable> { | |||
26 | parse.tree().syntax().descendants().filter_map(|i| runnable(db, file_id, i)).collect() | 26 | parse.tree().syntax().descendants().filter_map(|i| runnable(db, file_id, i)).collect() |
27 | } | 27 | } |
28 | 28 | ||
29 | fn runnable(db: &RootDatabase, file_id: FileId, item: &SyntaxNode) -> Option<Runnable> { | 29 | fn runnable(db: &RootDatabase, file_id: FileId, item: SyntaxNode) -> Option<Runnable> { |
30 | if let Some(fn_def) = ast::FnDef::cast(item) { | 30 | if let Some(fn_def) = ast::FnDef::cast(item.clone()) { |
31 | runnable_fn(fn_def) | 31 | runnable_fn(fn_def) |
32 | } else if let Some(m) = ast::Module::cast(item) { | 32 | } else if let Some(m) = ast::Module::cast(item) { |
33 | runnable_mod(db, file_id, m) | 33 | runnable_mod(db, file_id, m) |
@@ -36,8 +36,8 @@ fn runnable(db: &RootDatabase, file_id: FileId, item: &SyntaxNode) -> Option<Run | |||
36 | } | 36 | } |
37 | } | 37 | } |
38 | 38 | ||
39 | fn runnable_fn(fn_def: &ast::FnDef) -> Option<Runnable> { | 39 | fn runnable_fn(fn_def: ast::FnDef) -> Option<Runnable> { |
40 | let name = fn_def.name()?.text(); | 40 | let name = fn_def.name()?.text().clone(); |
41 | let kind = if name == "main" { | 41 | let kind = if name == "main" { |
42 | RunnableKind::Bin | 42 | RunnableKind::Bin |
43 | } else if fn_def.has_atom_attr("test") { | 43 | } else if fn_def.has_atom_attr("test") { |
@@ -50,7 +50,7 @@ fn runnable_fn(fn_def: &ast::FnDef) -> Option<Runnable> { | |||
50 | Some(Runnable { range: fn_def.syntax().range(), kind }) | 50 | Some(Runnable { range: fn_def.syntax().range(), kind }) |
51 | } | 51 | } |
52 | 52 | ||
53 | fn runnable_mod(db: &RootDatabase, file_id: FileId, module: &ast::Module) -> Option<Runnable> { | 53 | fn runnable_mod(db: &RootDatabase, file_id: FileId, module: ast::Module) -> Option<Runnable> { |
54 | let has_test_function = module | 54 | let has_test_function = module |
55 | .item_list()? | 55 | .item_list()? |
56 | .items() | 56 | .items() |