Skip to content

Commit

Permalink
[Rust] Fix scope for assignment operator
Browse files Browse the repository at this point in the history
Simply swap comparison and assignement operator to be sure
 assignment get tested first.
Add relevant test.

Fixes issue sublimehq#2147
  • Loading branch information
Clamsax committed Nov 16, 2019
1 parent 449ce95 commit b7f0e17
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
4 changes: 3 additions & 1 deletion Rust/Rust.sublime-syntax
Original file line number Diff line number Diff line change
Expand Up @@ -247,9 +247,11 @@ contexts:
operators:
- match: \.{2,3}
scope: keyword.operator.range.rust
- match: '(?:[-+%/*^&|]|<<|>>)='
scope: keyword.operator.assignment.rust
- match: '[!<>=]=|[<>]'
scope: keyword.operator.comparison.rust
- match: '(?:[-+%/*^&|]|<<|>>)?='
- match: '='
scope: keyword.operator.assignment.rust
push: after-operator
- match: '&&|\|\||!'
Expand Down
3 changes: 2 additions & 1 deletion Rust/syntax_test_rust.rs
Original file line number Diff line number Diff line change
Expand Up @@ -624,7 +624,8 @@ impl Point
// ^^^^ variable.language
// ^ punctuation.accessor.dot
// ^^ keyword.operator.assignment
self.y *= 2;
self.y >>= 2;
// ^^^ keyword.operator.assignment.rust
}

fn sum((x, y): (i32, i32)) -> i32 {
Expand Down

0 comments on commit b7f0e17

Please sign in to comment.