aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_ide_api/src/runnables.rs
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2019-07-19 12:15:55 +0100
committerbors[bot] <26634292+bors[bot]@users.noreply.github.com>2019-07-19 12:15:55 +0100
commitf209843e31af7f0e0212aa28ffec2efad2a70c6f (patch)
tree548227da78a3bea644f57714d075410c0bdf7469 /crates/ra_ide_api/src/runnables.rs
parent58d4983ba5745975446d60f2886d96f8d2adf0f2 (diff)
parentd4a66166c002f0a49e41d856a49cb5685ac93202 (diff)
Merge #1545
1545: migrate ra_syntax to the new rowan API r=matklad a=matklad Co-authored-by: Aleksey Kladov <[email protected]>
Diffstat (limited to 'crates/ra_ide_api/src/runnables.rs')
-rw-r--r--crates/ra_ide_api/src/runnables.rs10
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
29fn runnable(db: &RootDatabase, file_id: FileId, item: &SyntaxNode) -> Option<Runnable> { 29fn 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
39fn runnable_fn(fn_def: &ast::FnDef) -> Option<Runnable> { 39fn 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
53fn runnable_mod(db: &RootDatabase, file_id: FileId, module: &ast::Module) -> Option<Runnable> { 53fn 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()