aboutsummaryrefslogtreecommitdiffstats
path: root/queries/rust/highlights.scm
diff options
context:
space:
mode:
authorLewis Russell <lewis6991@gmail.com>2021-11-18 09:51:03 +0000
committerStephan Seitz <stephan.seitz@fau.de>2021-11-23 10:02:06 +0100
commit011ac894ec5b9e36563d8629fb7734f43ddb27a8 (patch)
treede0b252b7705bfa4304c08cd389fed0814ae6f1c /queries/rust/highlights.scm
parentUpdate lockfile.json (diff)
downloadnvim-treesitter-011ac894ec5b9e36563d8629fb7734f43ddb27a8.tar
nvim-treesitter-011ac894ec5b9e36563d8629fb7734f43ddb27a8.tar.gz
nvim-treesitter-011ac894ec5b9e36563d8629fb7734f43ddb27a8.tar.bz2
nvim-treesitter-011ac894ec5b9e36563d8629fb7734f43ddb27a8.tar.lz
nvim-treesitter-011ac894ec5b9e36563d8629fb7734f43ddb27a8.tar.xz
nvim-treesitter-011ac894ec5b9e36563d8629fb7734f43ddb27a8.tar.zst
nvim-treesitter-011ac894ec5b9e36563d8629fb7734f43ddb27a8.zip
Prefer lua-match over match
as string.find is much quicker than vim.regex:match*
Diffstat (limited to 'queries/rust/highlights.scm')
-rw-r--r--queries/rust/highlights.scm20
1 files changed, 10 insertions, 10 deletions
diff --git a/queries/rust/highlights.scm b/queries/rust/highlights.scm
index af8e6e5aa..0a97e75b1 100644
--- a/queries/rust/highlights.scm
+++ b/queries/rust/highlights.scm
@@ -6,12 +6,12 @@
(identifier) @variable
((identifier) @type
- (#match? @type "^[A-Z]"))
+ (#lua-match? @type "^[A-Z]"))
(const_item
name: (identifier) @constant)
; Assume all-caps names are constants
((identifier) @constant
- (#match? @constant "^[A-Z][A-Z\\d_]*$"))
+ (#lua-match? @constant "^[A-Z][A-Z%d_]*$"))
; Other identifiers
@@ -44,7 +44,7 @@
; Assume other uppercase names are enum constructors
((field_identifier) @constant
- (#match? @constant "^[A-Z]"))
+ (#lua-match? @constant "^[A-Z]"))
(enum_variant
name: (identifier) @constant)
@@ -62,10 +62,10 @@
name: (identifier) @namespace))
((scoped_identifier
path: (identifier) @type)
- (#match? @type "^[A-Z]"))
+ (#lua-match? @type "^[A-Z]"))
((scoped_identifier
name: (identifier) @type)
- (#match? @type "^[A-Z]"))
+ (#lua-match? @type "^[A-Z]"))
(crate) @namespace
(scoped_use_list
@@ -74,25 +74,25 @@
path: (scoped_identifier
(identifier) @namespace))
(use_list (scoped_identifier (identifier) @namespace . (_)))
-(use_list (identifier) @type (#match? @type "^[A-Z]"))
-(use_as_clause alias: (identifier) @type (#match? @type "^[A-Z]"))
+(use_list (identifier) @type (#lua-match? @type "^[A-Z]"))
+(use_as_clause alias: (identifier) @type (#lua-match? @type "^[A-Z]"))
;; Correct enum constructors
(call_expression
function: (scoped_identifier
"::"
name: (identifier) @constant)
- (#match? @constant "^[A-Z]"))
+ (#lua-match? @constant "^[A-Z]"))
; Assume uppercase names in a match arm are constants.
((match_arm
pattern: (match_pattern (identifier) @constant))
- (#match? @constant "^[A-Z]"))
+ (#lua-match? @constant "^[A-Z]"))
((match_arm
pattern: (match_pattern
(scoped_identifier
name: (identifier) @constant)))
- (#match? @constant "^[A-Z]"))
+ (#lua-match? @constant "^[A-Z]"))
((identifier) @constant.builtin
(#any-of? @constant.builtin "Some" "None" "Ok" "Err"))