diff options
| author | Tom Tromey <tom@tromey.com> | 2017-06-03 07:10:01 -0600 |
|---|---|---|
| committer | Tom Tromey <tom@tromey.com> | 2017-08-14 00:36:45 -0600 |
| commit | 38f7d891e62ce8bb8ff60a8126fb4ce06af5b6b5 (patch) | |
| tree | 3d70674852b81ecf156ce0e081335ef06c4d59dc /rust-mode.el | |
| parent | e48a650c44c06c1dd4e4ed0672c50c5446124203 (diff) | |
| download | rust-mode-38f7d891e62ce8bb8ff60a8126fb4ce06af5b6b5.tar.gz | |
Fix recognition of "<" as operator in some context
rust-mode identifies the "<<" as open angle brackets in
let x = a[i][(1 << i)];
This patch fixes the problem by changing rust-is-in-expression-context
to treat "]" as starting an expression in brace context.
Fixes #212
Diffstat (limited to 'rust-mode.el')
| -rw-r--r-- | rust-mode.el | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/rust-mode.el b/rust-mode.el index 1c0921b..ed5b5ed 100644 --- a/rust-mode.el +++ b/rust-mode.el @@ -812,6 +812,9 @@ match data if found. Returns nil if not within a Rust string." ;; it to be an expression. ((and (equal token 'open-brace) (rust-looking-back-macro)) t) + ;; In a brace context a "]" introduces an expression. + ((and (eq token 'open-brace) (rust-looking-back-str "]"))) + ;; An identifier is right after an ending paren, bracket, angle bracket ;; or curly brace. It's a type if the last sexp was a type. ((and (equal token 'ident) (equal 5 (rust-syntax-class-before-point))) |
