highlights(rust): distinguish between "for" in loops and impl_item

Fixes #3641
This commit is contained in:
Stephan Seitz 2022-10-15 02:29:32 +02:00
parent 9c3a1366bc
commit 53742779e3
2 changed files with 19 additions and 2 deletions

View file

@ -211,13 +211,15 @@
[
"break"
"continue"
"for"
"in"
"loop"
"while"
] @repeat
(impl_item
"for" @keyword)
(for_expression
"for" @repeat)
;;; Operators & Punctuation

View file

@ -0,0 +1,15 @@
struct Foo;
// Issue https://github.com/nvim-treesitter/nvim-treesitter/issues/3641
// Distinguish between for in loop or impl_item
impl Drop for Foo {
// ^ @keyword
fn drop(&mut self) {}
}
fn main() {
for i in 0..128 {
// <- @repeat
println!("{i}");
}
}