rust: Fix doc comment highlighting (#17976)

This PR fixes an issue where `/` and `!` in Rust doc comments were being
incorrectly highlighted as operators after #17734.

We solve this by removing them from the operators list and using more
scoped queries to highlight them.

Release Notes:

- N/A

---------

Co-authored-by: Max <max@zed.dev>
This commit is contained in:
Marshall Bowers 2024-09-17 18:32:22 -04:00 committed by GitHub
parent e7912370e6
commit db18f7a2b0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -139,7 +139,6 @@
] @comment.doc
[
"!"
"!="
"%"
"%="
@ -159,7 +158,6 @@
".."
"..="
"..."
"/"
"/="
":"
";"
@ -183,6 +181,10 @@
"?"
] @operator
; Avoid highlighting these as operators when used in doc comments.
(unary_expression "!" @operator)
operator: "/" @operator
(lifetime) @lifetime
(parameter (identifier) @variable.parameter)