From 38f7d891e62ce8bb8ff60a8126fb4ce06af5b6b5 Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Sat, 3 Jun 2017 07:10:01 -0600 Subject: 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 --- rust-mode.el | 3 +++ 1 file changed, 3 insertions(+) (limited to 'rust-mode.el') 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))) -- cgit v1.2.3