summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPer Nordlöw <per.nordlow@gmail.com>2016-10-02 15:37:09 +0200
committerAankhen <Aankhen@users.noreply.github.com>2017-08-10 21:01:01 +0530
commit6093d382fee9efc6cc29dd05246185079a0ff045 (patch)
tree216ce439ed49cc5848b44f63c6aa39e07432b94a
parentb10ad4177786a139623984c4855eb9de3864c697 (diff)
Add syntax coloring for type-inferred constants and variables
-rw-r--r--rust-mode.el6
1 files changed, 6 insertions, 0 deletions
diff --git a/rust-mode.el b/rust-mode.el
index 3b2a856..caf83a7 100644
--- a/rust-mode.el
+++ b/rust-mode.el
@@ -681,6 +681,12 @@ match data if found. Returns nil if not within a Rust string."
;; Field names like `foo:`, highlight excluding the :
(,(concat (rust-re-grab rust-re-ident) ":[^:]") 1 font-lock-variable-name-face)
+ ;; Type-inferred constant
+ (,(concat "\\_<\\(?:let\\|ref\\)\\s-+" (rust-re-grab rust-re-ident) "\\_>") 1 font-lock-constant-face)
+
+ ;; Type-inferred variable
+ (,(concat "\\_<\\(?:let\\|ref\\)\\s-+mut\\s-+" (rust-re-grab rust-re-ident) "\\_>") 1 font-lock-variable-name-face)
+
;; Type names like `Foo::`, highlight excluding the ::
(,(rust-path-font-lock-matcher rust-re-uc-ident) 1 font-lock-type-face)