File tree 3 files changed +25
-5
lines changed
3 files changed +25
-5
lines changed Original file line number Diff line number Diff line change @@ -92,7 +92,7 @@ pub use crate::completion::{
92
92
/// already present, it should give all possible variants for the identifier at
93
93
/// the caret. In other words, for
94
94
///
95
- /// ```no-run
95
+ /// ```no_run
96
96
/// fn f() {
97
97
/// let foo = 92;
98
98
/// let _ = bar<|>
Original file line number Diff line number Diff line change @@ -160,7 +160,7 @@ fn runnable_fn(
160
160
RunnableKind :: Test { test_id, attr }
161
161
} else if fn_def. has_atom_attr ( "bench" ) {
162
162
RunnableKind :: Bench { test_id }
163
- } else if has_doc_test ( & fn_def) {
163
+ } else if has_runnable_doc_test ( & fn_def) {
164
164
RunnableKind :: DocTest { test_id }
165
165
} else {
166
166
return None ;
@@ -211,8 +211,13 @@ fn has_test_related_attribute(fn_def: &ast::Fn) -> bool {
211
211
. any ( |attribute_text| attribute_text. contains ( "test" ) )
212
212
}
213
213
214
- fn has_doc_test ( fn_def : & ast:: Fn ) -> bool {
215
- fn_def. doc_comment_text ( ) . map_or ( false , |comment| comment. contains ( "```" ) )
214
+ fn has_runnable_doc_test ( fn_def : & ast:: Fn ) -> bool {
215
+ fn_def. doc_comment_text ( ) . map_or ( false , |comments_text| {
216
+ comments_text. contains ( "```" )
217
+ && !comments_text. contains ( "```ignore" )
218
+ && !comments_text. contains ( "```no_run" )
219
+ && !comments_text. contains ( "```compile_fail" )
220
+ } )
216
221
}
217
222
218
223
fn runnable_mod (
@@ -417,6 +422,21 @@ fn main() {}
417
422
/// let x = 5;
418
423
/// ```
419
424
fn foo() {}
425
+
426
+ /// ```no_run
427
+ /// let z = 55;
428
+ /// ```
429
+ fn should_have_no_runnable() {}
430
+
431
+ /// ```ignore
432
+ /// let z = 55;
433
+ /// ```
434
+ fn should_have_no_runnable_2() {}
435
+
436
+ /// ```compile_fail
437
+ /// let z = 55;
438
+ /// ```
439
+ fn should_have_no_runnable_3() {}
420
440
"# ,
421
441
& [ & BIN , & DOCTEST ] ,
422
442
expect ! [ [ r#"
Original file line number Diff line number Diff line change @@ -32,7 +32,7 @@ pub fn ancestors_at_offset(
32
32
/// imprecise: if the cursor is strictly between two nodes of the desired type,
33
33
/// as in
34
34
///
35
- /// ```no-run
35
+ /// ```no_run
36
36
/// struct Foo {}|struct Bar;
37
37
/// ```
38
38
///
You can’t perform that action at this time.
0 commit comments