rust: reduce false positives in runnables query (#11845)

We were marking `#[cfg(test)]`ed function as a test, which is wrong.
Also allow for other attribute_items (such as #[should_panic]) between
test attribute and a function item.

Release Notes:

- N/A
This commit is contained in:
Piotr Osiewicz 2024-05-15 11:42:05 +02:00 committed by GitHub
parent 8bc41e150e
commit 266643440c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1,6 +1,11 @@
(
(attribute_item (attribute) @attribute
(#match? @attribute ".*test"))
(attribute_item (attribute
[((identifier) @_attribute)
(scoped_identifier (identifier) @_attribute)
])
(#eq? @_attribute "test"))
.
(attribute_item) *
.
(function_item
name: (_) @run)