aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_ide/src/runnables.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_ide/src/runnables.rs')
-rw-r--r--crates/ra_ide/src/runnables.rs40
1 files changed, 20 insertions, 20 deletions
diff --git a/crates/ra_ide/src/runnables.rs b/crates/ra_ide/src/runnables.rs
index f612835c2..3b7162b84 100644
--- a/crates/ra_ide/src/runnables.rs
+++ b/crates/ra_ide/src/runnables.rs
@@ -102,7 +102,7 @@ pub(crate) fn runnable(
102) -> Option<Runnable> { 102) -> Option<Runnable> {
103 match_ast! { 103 match_ast! {
104 match item { 104 match item {
105 ast::FnDef(it) => runnable_fn(sema, it, file_id), 105 ast::Fn(it) => runnable_fn(sema, it, file_id),
106 ast::Module(it) => runnable_mod(sema, it, file_id), 106 ast::Module(it) => runnable_mod(sema, it, file_id),
107 _ => None, 107 _ => None,
108 } 108 }
@@ -111,7 +111,7 @@ pub(crate) fn runnable(
111 111
112fn runnable_fn( 112fn runnable_fn(
113 sema: &Semantics<RootDatabase>, 113 sema: &Semantics<RootDatabase>,
114 fn_def: ast::FnDef, 114 fn_def: ast::Fn,
115 file_id: FileId, 115 file_id: FileId,
116) -> Option<Runnable> { 116) -> Option<Runnable> {
117 let name_string = fn_def.name()?.text().to_string(); 117 let name_string = fn_def.name()?.text().to_string();
@@ -188,7 +188,7 @@ pub struct TestAttr {
188} 188}
189 189
190impl TestAttr { 190impl TestAttr {
191 fn from_fn(fn_def: &ast::FnDef) -> TestAttr { 191 fn from_fn(fn_def: &ast::Fn) -> TestAttr {
192 let ignore = fn_def 192 let ignore = fn_def
193 .attrs() 193 .attrs()
194 .filter_map(|attr| attr.simple_name()) 194 .filter_map(|attr| attr.simple_name())
@@ -203,7 +203,7 @@ impl TestAttr {
203/// 203///
204/// It may produce false positives, for example, `#[wasm_bindgen_test]` requires a different command to run the test, 204/// It may produce false positives, for example, `#[wasm_bindgen_test]` requires a different command to run the test,
205/// but it's better than not to have the runnables for the tests at all. 205/// but it's better than not to have the runnables for the tests at all.
206fn has_test_related_attribute(fn_def: &ast::FnDef) -> bool { 206fn has_test_related_attribute(fn_def: &ast::Fn) -> bool {
207 fn_def 207 fn_def
208 .attrs() 208 .attrs()
209 .filter_map(|attr| attr.path()) 209 .filter_map(|attr| attr.path())
@@ -211,7 +211,7 @@ fn has_test_related_attribute(fn_def: &ast::FnDef) -> bool {
211 .any(|attribute_text| attribute_text.contains("test")) 211 .any(|attribute_text| attribute_text.contains("test"))
212} 212}
213 213
214fn has_doc_test(fn_def: &ast::FnDef) -> bool { 214fn has_doc_test(fn_def: &ast::Fn) -> bool {
215 fn_def.doc_comment_text().map_or(false, |comment| comment.contains("```")) 215 fn_def.doc_comment_text().map_or(false, |comment| comment.contains("```"))
216} 216}
217 217
@@ -246,7 +246,7 @@ fn has_test_function_or_multiple_test_submodules(module: &ast::Module) -> bool {
246 246
247 for item in item_list.items() { 247 for item in item_list.items() {
248 match item { 248 match item {
249 ast::Item::FnDef(f) => { 249 ast::Item::Fn(f) => {
250 if has_test_related_attribute(&f) { 250 if has_test_related_attribute(&f) {
251 return true; 251 return true;
252 } 252 }
@@ -320,7 +320,7 @@ fn bench() {}
320 4..8, 320 4..8,
321 ), 321 ),
322 name: "main", 322 name: "main",
323 kind: FN_DEF, 323 kind: FN,
324 container_name: None, 324 container_name: None,
325 description: None, 325 description: None,
326 docs: None, 326 docs: None,
@@ -338,7 +338,7 @@ fn bench() {}
338 26..34, 338 26..34,
339 ), 339 ),
340 name: "test_foo", 340 name: "test_foo",
341 kind: FN_DEF, 341 kind: FN,
342 container_name: None, 342 container_name: None,
343 description: None, 343 description: None,
344 docs: None, 344 docs: None,
@@ -363,7 +363,7 @@ fn bench() {}
363 62..70, 363 62..70,
364 ), 364 ),
365 name: "test_foo", 365 name: "test_foo",
366 kind: FN_DEF, 366 kind: FN,
367 container_name: None, 367 container_name: None,
368 description: None, 368 description: None,
369 docs: None, 369 docs: None,
@@ -388,7 +388,7 @@ fn bench() {}
388 89..94, 388 89..94,
389 ), 389 ),
390 name: "bench", 390 name: "bench",
391 kind: FN_DEF, 391 kind: FN,
392 container_name: None, 392 container_name: None,
393 description: None, 393 description: None,
394 docs: None, 394 docs: None,
@@ -431,7 +431,7 @@ fn foo() {}
431 4..8, 431 4..8,
432 ), 432 ),
433 name: "main", 433 name: "main",
434 kind: FN_DEF, 434 kind: FN,
435 container_name: None, 435 container_name: None,
436 description: None, 436 description: None,
437 docs: None, 437 docs: None,
@@ -447,7 +447,7 @@ fn foo() {}
447 full_range: 15..57, 447 full_range: 15..57,
448 focus_range: None, 448 focus_range: None,
449 name: "foo", 449 name: "foo",
450 kind: FN_DEF, 450 kind: FN,
451 container_name: None, 451 container_name: None,
452 description: None, 452 description: None,
453 docs: None, 453 docs: None,
@@ -493,7 +493,7 @@ impl Data {
493 4..8, 493 4..8,
494 ), 494 ),
495 name: "main", 495 name: "main",
496 kind: FN_DEF, 496 kind: FN,
497 container_name: None, 497 container_name: None,
498 description: None, 498 description: None,
499 docs: None, 499 docs: None,
@@ -509,7 +509,7 @@ impl Data {
509 full_range: 44..98, 509 full_range: 44..98,
510 focus_range: None, 510 focus_range: None,
511 name: "foo", 511 name: "foo",
512 kind: FN_DEF, 512 kind: FN,
513 container_name: None, 513 container_name: None,
514 description: None, 514 description: None,
515 docs: None, 515 docs: None,
@@ -570,7 +570,7 @@ mod test_mod {
570 35..44, 570 35..44,
571 ), 571 ),
572 name: "test_foo1", 572 name: "test_foo1",
573 kind: FN_DEF, 573 kind: FN,
574 container_name: None, 574 container_name: None,
575 description: None, 575 description: None,
576 docs: None, 576 docs: None,
@@ -670,7 +670,7 @@ mod root_tests {
670 107..121, 670 107..121,
671 ), 671 ),
672 name: "nested_test_11", 672 name: "nested_test_11",
673 kind: FN_DEF, 673 kind: FN,
674 container_name: None, 674 container_name: None,
675 description: None, 675 description: None,
676 docs: None, 676 docs: None,
@@ -695,7 +695,7 @@ mod root_tests {
695 163..177, 695 163..177,
696 ), 696 ),
697 name: "nested_test_12", 697 name: "nested_test_12",
698 kind: FN_DEF, 698 kind: FN,
699 container_name: None, 699 container_name: None,
700 description: None, 700 description: None,
701 docs: None, 701 docs: None,
@@ -740,7 +740,7 @@ mod root_tests {
740 258..271, 740 258..271,
741 ), 741 ),
742 name: "nested_test_2", 742 name: "nested_test_2",
743 kind: FN_DEF, 743 kind: FN,
744 container_name: None, 744 container_name: None,
745 description: None, 745 description: None,
746 docs: None, 746 docs: None,
@@ -783,7 +783,7 @@ fn test_foo1() {}
783 36..45, 783 36..45,
784 ), 784 ),
785 name: "test_foo1", 785 name: "test_foo1",
786 kind: FN_DEF, 786 kind: FN,
787 container_name: None, 787 container_name: None,
788 description: None, 788 description: None,
789 docs: None, 789 docs: None,
@@ -831,7 +831,7 @@ fn test_foo1() {}
831 58..67, 831 58..67,
832 ), 832 ),
833 name: "test_foo1", 833 name: "test_foo1",
834 kind: FN_DEF, 834 kind: FN,
835 container_name: None, 835 container_name: None,
836 description: None, 836 description: None,
837 docs: None, 837 docs: None,