summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormrBliss <dewinant@gmail.com>2015-11-26 21:14:51 +0100
committermrBliss <dewinant@gmail.com>2015-11-26 21:19:09 +0100
commit339afbaf47b3b2d3e457e0000c9fa932548e37a1 (patch)
treed331d618c7b1b3b7ac33631fef129ba48707332e
parent0601540d43b901b0ad0ec62363a143cd3a054364 (diff)
downloadrust-mode-339afbaf47b3b2d3e457e0000c9fa932548e37a1.tar.gz
Highlight the unsafe keyword
-rw-r--r--rust-mode.el10
1 files changed, 9 insertions, 1 deletions
diff --git a/rust-mode.el b/rust-mode.el
index 5b50d29..5bdefe5 100644
--- a/rust-mode.el
+++ b/rust-mode.el
@@ -173,6 +173,11 @@
:safe #'booleanp
:group 'rust-mode)
+(defface rust-unsafe-face
+ '((t :inherit font-lock-warning-face))
+ "Face for the `unsafe' keyword."
+ :group 'rust-mode)
+
(defun rust-paren-level () (nth 0 (syntax-ppss)))
(defun rust-in-str-or-cmnt () (nth 8 (syntax-ppss)))
(defun rust-rewind-past-str-cmnt () (goto-char (nth 8 (syntax-ppss))))
@@ -414,7 +419,7 @@
"ref" "return"
"self" "static" "struct" "super"
"true" "trait" "type"
- "unsafe" "use"
+ "use"
"virtual"
"where" "while"))
@@ -455,6 +460,9 @@
;; Special types
(,(regexp-opt-symbols rust-special-types) . font-lock-type-face)
+ ;; The unsafe keyword
+ ("\\_<unsafe\\_>" . 'rust-unsafe-face)
+
;; Attributes like `#[bar(baz)]` or `#![bar(baz)]` or `#[bar = "baz"]`
(,(rust-re-grab (concat "#\\!?\\[" rust-re-ident "[^]]*\\]"))
1 font-lock-preprocessor-face keep)