branch: elpa/rust-mode commit 65f96278b24b89c13e79b38a071a98824d108bb8 Merge: b017f74650 b83b34e82d Author: brotzeit <brotzeitmac...@gmail.com> Commit: GitHub <nore...@github.com>
Merge pull request #428 from Chris00/ampersand Add a face for the ampersand reference mark --- rust-mode-tests.el | 1 + rust-mode.el | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/rust-mode-tests.el b/rust-mode-tests.el index 9c23ed40b2..24c26823f7 100644 --- a/rust-mode-tests.el +++ b/rust-mode-tests.el @@ -1699,6 +1699,7 @@ this_is_not_a_string();)" "foo" font-lock-type-face "x" font-lock-variable-name-face ;; This union is the name of a lifetime. + "&" rust-ampersand-face "union" font-lock-variable-name-face "bar" font-lock-type-face))) diff --git a/rust-mode.el b/rust-mode.el index fca9e9f3fa..57feaaa59a 100644 --- a/rust-mode.el +++ b/rust-mode.el @@ -101,6 +101,11 @@ to the function arguments. When nil, `->' will be indented one level." "Face for the question mark operator." :group 'rust-mode) +(defface rust-ampersand-face + '((t :inherit default)) + "Face for the ampersand reference mark." + :group 'rust-mode) + (defface rust-builtin-formatting-macro '((t :inherit font-lock-builtin-face)) "Face for builtin formatting macros (print! &c.)." @@ -437,6 +442,7 @@ Does not match type annotations of the form \"foo::<\"." ;; Question mark operator ("\\?" . 'rust-question-mark) + ("\\(&\\)'?\\<" 1 'rust-ampersand-face) ) ;; Ensure we highlight `Foo` in `struct Foo` as a type.