rust: Fix test/doctest tasks showing up outside of tests (#25787)

Closes #ISSUE

Release Notes:

- Fixes Rust test tasks showing up outside of tests
This commit is contained in:
Piotr Osiewicz 2025-02-28 00:48:19 +01:00 committed by GitHub
parent 62fb555e18
commit b15aa5e018
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 33 additions and 16 deletions

View file

@ -22,7 +22,7 @@
[(line_comment) (block_comment)] *
.
(function_item
name: (_) @run
name: (_) @run @_test_name
body: _
) @_end
)
@ -35,34 +35,35 @@
(line_comment) *
(line_comment
doc: (_) @_comment_content
) @start
) @_start @run
(#match? @_comment_content "```")
.
(line_comment) *
.
(line_comment
doc: (_) @_end_comment_content
) @_end_code_block
(#match? @_end_comment_content "```")
.
(line_comment) *
(attribute_item) *
.
[(line_comment) (block_comment)] *
.
[(function_item
name: (_) @run
name: (_) @_doc_test_name
body: _
) (function_signature_item
name: (_) @run
name: (_) @_doc_test_name
) (struct_item
name: (_) @run
name: (_) @_doc_test_name
) (enum_item
name: (_) @run
name: (_) @_doc_test_name
body: _
) (
(attribute_item) ?
(macro_definition
name: (_) @run)
name: (_) @_doc_test_name)
) (mod_item
name: (_) @run
name: (_) @_doc_test_name
)] @_end
)
(#set! tag rust-doc-test)