summaryrefslogtreecommitdiff
path: root/rust-mode.el
diff options
context:
space:
mode:
authorMicah Chalmer <micah@micahchalmer.net>2015-12-15 22:34:23 -0500
committerMicah Chalmer <micah@micahchalmer.net>2015-12-15 22:34:23 -0500
commit061e6d8a3a9104570144f1eacb729e3211cb03cd (patch)
tree320f226052b8c063fe98a275e78f1a8e97664956 /rust-mode.el
parentb874bbe927e460695bd0bb7caf53b5dd8fe57a85 (diff)
parent339afbaf47b3b2d3e457e0000c9fa932548e37a1 (diff)
downloadrust-mode-061e6d8a3a9104570144f1eacb729e3211cb03cd.tar.gz
Merge pull request #109 from mrBliss/highlight-unsafe
Highlight the unsafe keyword
Diffstat (limited to 'rust-mode.el')
-rw-r--r--rust-mode.el10
1 files changed, 9 insertions, 1 deletions
diff --git a/rust-mode.el b/rust-mode.el
index a2c81f7..8049273 100644
--- a/rust-mode.el
+++ b/rust-mode.el
@@ -180,6 +180,11 @@ function or trait. When nil, where will be aligned with fn or trait."
: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))))
@@ -488,7 +493,7 @@ function or trait. When nil, where will be aligned with fn or trait."
"ref" "return"
"self" "static" "struct" "super"
"true" "trait" "type"
- "unsafe" "use"
+ "use"
"virtual"
"where" "while"))
@@ -529,6 +534,9 @@ function or trait. When nil, where will be aligned with fn or trait."
;; 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)