[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/rust-mode 90f70ac 328/486: Use `font-lock-variable-name-fa
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/rust-mode 90f70ac 328/486: Use `font-lock-variable-name-face' for `let' bindings. |
Date: |
Sat, 7 Aug 2021 09:25:46 -0400 (EDT) |
branch: elpa/rust-mode
commit 90f70acec333887f925ed1b4b1b46f68d5442f41
Author: Aankhen <Aankhen@users.noreply.github.com>
Commit: Aankhen <Aankhen@users.noreply.github.com>
Use `font-lock-variable-name-face' for `let' bindings.
---
rust-mode-tests.el | 42 +++++++++++++++++++++++++++++++++++++++++-
rust-mode.el | 7 ++-----
2 files changed, 43 insertions(+), 6 deletions(-)
diff --git a/rust-mode-tests.el b/rust-mode-tests.el
index a9b4af9..7335334 100644
--- a/rust-mode-tests.el
+++ b/rust-mode-tests.el
@@ -1284,12 +1284,46 @@ list of substrings of `STR' each followed by its face."
'("fn" font-lock-keyword-face
"foo_Bar" font-lock-function-name-face)))
+(ert-deftest font-lock-let-bindings ()
+ (rust-test-font-lock
+ "let foo;"
+ '("let" font-lock-keyword-face
+ "foo" font-lock-variable-name-face))
+ (rust-test-font-lock
+ "let mut foo;"
+ '("let" font-lock-keyword-face
+ "mut" font-lock-keyword-face
+ "foo" font-lock-variable-name-face))
+ (rust-test-font-lock
+ "let foo = 1;"
+ '("let" font-lock-keyword-face
+ "foo" font-lock-variable-name-face))
+ (rust-test-font-lock
+ "let mut foo = 1;"
+ '("let" font-lock-keyword-face
+ "mut" font-lock-keyword-face
+ "foo" font-lock-variable-name-face))
+ (rust-test-font-lock
+ "fn foo() { let bar = 1; }"
+ '("fn" font-lock-keyword-face
+ "foo" font-lock-function-name-face
+ "let" font-lock-keyword-face
+ "bar" font-lock-variable-name-face))
+ (rust-test-font-lock
+ "fn foo() { let mut bar = 1; }"
+ '("fn" font-lock-keyword-face
+ "foo" font-lock-function-name-face
+ "let" font-lock-keyword-face
+ "mut" font-lock-keyword-face
+ "bar" font-lock-variable-name-face)))
+
(ert-deftest font-lock-single-quote-character-literal ()
(rust-test-font-lock
"fn main() { let ch = '\\''; }"
'("fn" font-lock-keyword-face
"main" font-lock-function-name-face
"let" font-lock-keyword-face
+ "ch" font-lock-variable-name-face
"'\\''" font-lock-string-face)))
(ert-deftest font-lock-escaped-double-quote-character-literal ()
@@ -1298,6 +1332,7 @@ list of substrings of `STR' each followed by its face."
'("fn" font-lock-keyword-face
"main" font-lock-function-name-face
"let" font-lock-keyword-face
+ "ch" font-lock-variable-name-face
"'\\\"'" font-lock-string-face)))
(ert-deftest font-lock-escaped-backslash-character-literal ()
@@ -1306,18 +1341,21 @@ list of substrings of `STR' each followed by its face."
'("fn" font-lock-keyword-face
"main" font-lock-function-name-face
"let" font-lock-keyword-face
+ "ch" font-lock-variable-name-face
"'\\\\'" font-lock-string-face)))
(ert-deftest font-lock-hex-escape-character-literal ()
(rust-test-font-lock
"let ch = '\\x1f';"
'("let" font-lock-keyword-face
+ "ch" font-lock-variable-name-face
"'\\x1f'" font-lock-string-face)))
(ert-deftest font-lock-unicode-escape-character-literal ()
(rust-test-font-lock
"let ch = '\\u{1ffff}';"
'("let" font-lock-keyword-face
+ "ch" font-lock-variable-name-face
"'\\u{1ffff}'" font-lock-string-face)))
(ert-deftest font-lock-raw-strings-no-hashes ()
@@ -1583,6 +1621,7 @@ this_is_not_a_string();)"
(rust-test-font-lock
"let default = 7; impl foo { default fn f() { } }"
'("let" font-lock-keyword-face
+ "default" font-lock-variable-name-face
"impl" font-lock-keyword-face
"default" font-lock-keyword-face
"fn" font-lock-keyword-face
@@ -1592,7 +1631,8 @@ this_is_not_a_string();)"
(rust-test-font-lock
"let union = 7; union foo { x: &'union bar }"
'("let" font-lock-keyword-face
- ;; Ignore the first union, it's an unhighlighted variable.
+ ;; The first union is a variable name.
+ "union" font-lock-variable-name-face
;; The second union is a contextual keyword.
"union" font-lock-keyword-face
"foo" font-lock-type-face
diff --git a/rust-mode.el b/rust-mode.el
index caf83a7..1c0921b 100644
--- a/rust-mode.el
+++ b/rust-mode.el
@@ -681,11 +681,8 @@ 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-inferred binding
+ (,(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)
- [nongnu] elpa/rust-mode c2a0c13 269/486: Add info to enable rustfmt, (continued)
- [nongnu] elpa/rust-mode c2a0c13 269/486: Add info to enable rustfmt, ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode cd09a54 280/486: Merge pull request #189 from froydnj/minor-cleanups, ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode 19e6f60 291/486: Merge pull request #199 from tromey/open-paren-in-column-0, ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode 7f7b2ac 293/486: mention keybinding for rustfmt, ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode 758ab8c 303/486: Add support for "default" keyword, ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode a73e9ee 004/486: Update reserved words for syntax highlighters (vim is still behind, though), ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode 7724813 306/486: Merge pull request #206 from cjhowe7/master, ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode ac6a45e 308/486: Merge pull request #213 from KeenS/restore-points, ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode d38bfb8 309/486: Set `compile-command' in `rust-mode'., ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode c00c8a9 312/486: Require `json'., ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode 90f70ac 328/486: Use `font-lock-variable-name-face' for `let' bindings.,
ELPA Syncer <=
- [nongnu] elpa/rust-mode 9eda807 341/486: Merge pull request #239 from shepmaster/no-more-int-float, ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode 1275a19 363/486: make rustc-colon-compilation-regexps an info type, ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode 9154e0e 372/486: silence byte-compiler, ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode 5f37343 379/486: Add rust-indent-return-type-to-arguments variable, ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode 8cd18cc 385/486: Merge pull request #293 from TristanCacqueray/master, ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode df31a6e 393/486: Don't call syntax-ppss twice for strings ending with r., ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode 942d465 398/486: Update Debian installation instructions, ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode af84c0f 403/486: Merge pull request #319 from phillord/feature/update-emacs-versions, ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode 4c8754b 430/486: Merge pull request #343 from haroldcarr/master, ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode 4381a89 433/486: Fix scrolling after rustfmt. (#351), ELPA Syncer, 2021/08/07