Skip to content

Commit b83b34e

Browse files
committed
Add a face for the ampersand reference mark
Customizing this face may improve code readability for some users. By default nothing is set for backward compatibility.
1 parent b017f74 commit b83b34e

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

rust-mode-tests.el

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1699,6 +1699,7 @@ this_is_not_a_string();)"
16991699
"foo" font-lock-type-face
17001700
"x" font-lock-variable-name-face
17011701
;; This union is the name of a lifetime.
1702+
"&" rust-ampersand-face
17021703
"union" font-lock-variable-name-face
17031704
"bar" font-lock-type-face)))
17041705

rust-mode.el

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,11 @@ to the function arguments. When nil, `->' will be indented one level."
101101
"Face for the question mark operator."
102102
:group 'rust-mode)
103103

104+
(defface rust-ampersand-face
105+
'((t :inherit default))
106+
"Face for the ampersand reference mark."
107+
:group 'rust-mode)
108+
104109
(defface rust-builtin-formatting-macro
105110
'((t :inherit font-lock-builtin-face))
106111
"Face for builtin formatting macros (print! &c.)."
@@ -437,6 +442,7 @@ Does not match type annotations of the form \"foo::<\"."
437442

438443
;; Question mark operator
439444
("\\?" . 'rust-question-mark)
445+
("\\(&\\)'?\\<" 1 'rust-ampersand-face)
440446
)
441447

442448
;; Ensure we highlight `Foo` in `struct Foo` as a type.

0 commit comments

Comments
 (0)