aboutsummaryrefslogtreecommitdiffstats
path: root/queries/rust
diff options
context:
space:
mode:
Diffstat (limited to 'queries/rust')
-rw-r--r--queries/rust/highlights.scm9
1 files changed, 6 insertions, 3 deletions
diff --git a/queries/rust/highlights.scm b/queries/rust/highlights.scm
index 94301fc2e..1d5f3d736 100644
--- a/queries/rust/highlights.scm
+++ b/queries/rust/highlights.scm
@@ -9,7 +9,7 @@
name: (identifier) @constant)
; Assume all-caps names are constants
((identifier) @constant
- (#match? @constant "^[A-Z][A-Z\\d_]+$'"))
+ (#match? @constant "^[A-Z][A-Z\\d_]*$"))
; Other identifiers
@@ -41,9 +41,12 @@
field: (field_identifier) @function))
; Assume other uppercase names are enum constructors
-([(identifier) (field_identifier)] @constant
+((field_identifier) @constant
(#match? @constant "^[A-Z]"))
+(enum_variant
+ name: (identifier) @constant)
+
; Assume that uppercase names in paths are types
(scoped_identifier
path: (identifier) @namespace)
@@ -84,7 +87,7 @@
(metavariable) @function.macro
;; Attribute macros
-(meta_item (identifier) @function.macro)
+(attribute_item (meta_item (identifier) @function.macro))
(meta_item (scoped_identifier (identifier) @function.macro .))
;; Derive macros (assume all arguments are types)