emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[nongnu] elpa/rust-mode c49bb12 184/486: Cache (regexp-opt rust-special-


From: ELPA Syncer
Subject: [nongnu] elpa/rust-mode c49bb12 184/486: Cache (regexp-opt rust-special-types 'symbols) in rust-is-lt-char-operator
Date: Sat, 7 Aug 2021 09:25:15 -0400 (EDT)

branch: elpa/rust-mode
commit c49bb125fc9beb835ffee8d78625cbe7541dd262
Author: Ben Segall <talchas@talchas.net>
Commit: Ben Segall <talchas@talchas.net>

    Cache (regexp-opt rust-special-types 'symbols) in rust-is-lt-char-operator
    
    regexp-opt is generally intended to be cached, and the extra GC was
    causing noticeable lag when typing sometimes.
---
 rust-mode.el | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/rust-mode.el b/rust-mode.el
index 40a2492..e451dfa 100644
--- a/rust-mode.el
+++ b/rust-mode.el
@@ -378,6 +378,7 @@
 ;; newer Emacs versions, but will work on Emacs 23.)
 (defun regexp-opt-symbols (words)
   (concat "\\_<" (regexp-opt words t) "\\_>"))
+(defconst rust-re-special-types (regexp-opt-symbols rust-special-types))
 
 (defvar rust-mode-font-lock-keywords
   (append
@@ -851,7 +852,7 @@
         (or
          ;; The special types can't take type param lists, so a < after one is
          ;; always an operator
-         (looking-at (regexp-opt rust-special-types 'symbols))
+         (looking-at rust-re-special-types)
          
          (rust-is-in-expression-context 'ident)))
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]