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

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

[nongnu] elpa/rust-mode 012537b 195/486: remove byte-compiler warnings a


From: ELPA Syncer
Subject: [nongnu] elpa/rust-mode 012537b 195/486: remove byte-compiler warnings and prevent future ones
Date: Sat, 7 Aug 2021 09:25:17 -0400 (EDT)

branch: elpa/rust-mode
commit 012537b6c915afedaa458642bd23b0937b11d6b1
Author: Tom Tromey <tom@tromey.com>
Commit: Tom Tromey <tom@tromey.com>

    remove byte-compiler warnings and prevent future ones
---
 run_rust_emacs_tests.sh |   9 ++++
 rust-mode.el            | 138 +++++++++++++++++++++++++-----------------------
 2 files changed, 81 insertions(+), 66 deletions(-)

diff --git a/run_rust_emacs_tests.sh b/run_rust_emacs_tests.sh
index c065c9e..ac5e3dc 100755
--- a/run_rust_emacs_tests.sh
+++ b/run_rust_emacs_tests.sh
@@ -31,4 +31,13 @@ $( $EMACS -batch --eval "(require 'ert)" > /dev/null 2>&1 ) 
|| {
     exit 3
 };
 
+warnings="$( $EMACS -Q -batch -f batch-byte-compile rust-mode.el 2>&1 | grep 
-v '^Wrote ' )"
+if [ -n "$warnings" ]; then
+    echo "Byte-compilation failed:"
+    echo "$warnings"
+    exit 4
+else
+    echo "Byte-compilation passed."
+fi
+
 $EMACS -batch -l rust-mode.el -l rust-mode-tests.el -f 
ert-run-tests-batch-and-exit
diff --git a/rust-mode.el b/rust-mode.el
index 2a0ad19..ff6814b 100644
--- a/rust-mode.el
+++ b/rust-mode.el
@@ -11,7 +11,10 @@
 ;;; Code:
 
 (eval-when-compile (require 'misc)
-                   (require 'rx))
+                   (require 'rx)
+                   (require 'compile))
+
+(defvar electric-pair-inhibit-predicate)
 
 ;; for GNU Emacs < 24.3
 (eval-when-compile
@@ -20,6 +23,70 @@
       "Set variable VAR to value VAL in current buffer."
       (list 'set (list 'make-local-variable (list 'quote var)) val))))
 
+(defconst rust-re-ident 
"[[:word:][:multibyte:]_][[:word:][:multibyte:]_[:digit:]]*")
+
+(defconst rust-re-non-standard-string
+  (rx
+   (or
+    ;; Raw string: if it matches, it ends up with the starting character
+    ;; of the string as group 1, any ending backslashes as group 4, and
+    ;; the ending character as either group 5 or group 6.
+    (seq
+     ;; The "r" starts the raw string.  Capture it as group 1 to mark it as 
such syntactically:
+     (group "r")
+
+     ;; Then either:
+     (or
+      ;; a sequence at least one "#" (followed by quote).  Capture all
+      ;; but the last "#" as group 2 for this case.
+      (seq (group (* "#")) "#\"")
+
+      ;; ...or a quote without any "#".  Capture it as group 3. This is
+      ;; used later to match the opposite quote only if this capture
+      ;; occurred
+      (group "\""))
+
+     ;; The contents of the string:
+     (*? anything)
+
+     ;; If there are any backslashes at the end of the string, capture
+     ;; them as group 4 so we can suppress the normal escape syntax
+     ;; parsing:
+     (group (* "\\"))
+
+     ;; Then the end of the string--the backreferences ensure that we
+     ;; only match the kind of ending that corresponds to the beginning
+     ;; we had:
+     (or
+      ;; There were "#"s - capture the last one as group 5 to mark it as
+      ;; the end of the string:
+      (seq "\"" (backref 2) (group "#"))
+
+      ;; No "#"s - capture the ending quote (using a backref to group 3,
+      ;; so that we can't match a quote if we had "#"s) as group 6
+      (group (backref 3))
+
+      ;; If the raw string wasn't actually closed, go all the way to the end
+      string-end))
+
+    ;; Character literal: match the beginning ' of a character literal
+    ;; as group 7, and the ending one as group 8
+    (seq
+     (group "'")
+     (or
+      (seq
+       "\\"
+       (or
+        (: "U" (= 8 xdigit))
+        (: "u" (= 4 xdigit))
+        (: "x" (= 2 xdigit))
+        (any "'nrt0\"\\")))
+      (not (any "'\\"))
+      )
+     (group "'"))
+    )
+   ))
+
 (defun rust-looking-back-str (str)
   "Like `looking-back' but for fixed strings rather than regexps (so that it's 
not so slow)"
   (let ((len (length str)))
@@ -145,8 +212,6 @@
       (backward-up-list)
       (back-to-indentation))))
 
-(defconst rust-re-ident 
"[[:word:][:multibyte:]_][[:word:][:multibyte:]_[:digit:]]*")
-
 (defun rust-align-to-method-chain ()
   (save-excursion
     ;; for method-chain alignment to apply, we must be looking at
@@ -420,6 +485,9 @@
              ("fn" . font-lock-function-name-face)
              ("static" . font-lock-constant-face)))))
 
+(defvar font-lock-beg)
+(defvar font-lock-end)
+
 (defun rust-font-lock-extend-region ()
   "Extend the region given by `font-lock-beg' and `font-lock-end'
   to include the beginning of a string or comment if it includes
@@ -490,68 +558,6 @@
       (set-match-data (nth 1 ret-list))
       (nth 0 ret-list))))
 
-(defconst rust-re-non-standard-string
-  (rx
-   (or
-    ;; Raw string: if it matches, it ends up with the starting character
-    ;; of the string as group 1, any ending backslashes as group 4, and
-    ;; the ending character as either group 5 or group 6.
-    (seq
-     ;; The "r" starts the raw string.  Capture it as group 1 to mark it as 
such syntactically:
-     (group "r")
-
-     ;; Then either:
-     (or
-      ;; a sequence at least one "#" (followed by quote).  Capture all
-      ;; but the last "#" as group 2 for this case.
-      (seq (group (* "#")) "#\"")
-
-      ;; ...or a quote without any "#".  Capture it as group 3. This is
-      ;; used later to match the opposite quote only if this capture
-      ;; occurred
-      (group "\""))
-
-     ;; The contents of the string:
-     (*? anything)
-
-     ;; If there are any backslashes at the end of the string, capture
-     ;; them as group 4 so we can suppress the normal escape syntax
-     ;; parsing:
-     (group (* "\\"))
-
-     ;; Then the end of the string--the backreferences ensure that we
-     ;; only match the kind of ending that corresponds to the beginning
-     ;; we had:
-     (or
-      ;; There were "#"s - capture the last one as group 5 to mark it as
-      ;; the end of the string:
-      (seq "\"" (backref 2) (group "#"))
-
-      ;; No "#"s - capture the ending quote (using a backref to group 3,
-      ;; so that we can't match a quote if we had "#"s) as group 6
-      (group (backref 3))
-
-      ;; If the raw string wasn't actually closed, go all the way to the end
-      string-end))
-
-    ;; Character literal: match the beginning ' of a character literal
-    ;; as group 7, and the ending one as group 8
-    (seq
-     (group "'")
-     (or
-      (seq
-       "\\"
-       (or
-        (: "U" (= 8 xdigit))
-        (: "u" (= 4 xdigit))
-        (: "x" (= 2 xdigit))
-        (any "'nrt0\"\\")))
-      (not (any "'\\"))
-      )
-     (group "'"))
-    )
-   ))
-
 (defun rust-look-for-non-standard-string (bound)
   ;; Find a raw string or character literal, but only if it's not in the middle
   ;; of another string or a comment.
@@ -769,7 +775,7 @@
            ;; Otherwise, if the ident: appeared with anything other than , or {
            ;; before it, it can't be part of a struct initializer and therefore
            ;; must be denoting a type.
-           nil
+          (t nil)
            ))
          ))
 



reply via email to

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