[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)
))
))
- [nongnu] elpa/rust-mode 4d633fc 125/486: Merge pull request #32 from MicahChalmer/raw-string-handling, (continued)
- [nongnu] elpa/rust-mode 4d633fc 125/486: Merge pull request #32 from MicahChalmer/raw-string-handling, ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode 8d99bf8 126/486: Merge pull request #31 from pnkfelix/more-robust-test-driver, ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode e16c37c 161/486: Remove Marmalade from the README, ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode ee171df 172/486: test $EMACS directly rather than using "which", ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode d1ed015 173/486: Distinguish face for doc-comments, ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode c9c7871 179/486: Merge pull request #79 from MicahChalmer/angle-bracket-madness, ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode ee564d5 185/486: Merge pull request #85 from talchas/master, ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode 99b128c 187/486: Fix slowness in angle bracket matching, ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode 5e77aed 191/486: Correcting highlighting of capitals in function names., ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode 5e51aaa 194/486: Merge pull request #69 from tromey/safe-local-variables, ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode 012537b 195/486: remove byte-compiler warnings and prevent future ones,
ELPA Syncer <=
- [nongnu] elpa/rust-mode 866df37 196/486: make rust-mode use lexical binding, ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode 6252cf1 217/486: Fix indentation of closing delimiters, ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode dd6d417 215/486: Fix type annotations incorrectly highlighted as modules., ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode 86d636a 223/486: Remove duplicate keywords, ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode b1cca0f 222/486: Merge pull request #72 from birkenfeld/builtin-face, ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode 061e6d8 214/486: Merge pull request #109 from mrBliss/highlight-unsafe, ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode 86c55b1 220/486: Integrate rustfmt support, ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode beec95a 231/486: Allow disabling rustfmt with a dir-local/file-local variable, ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode 6739dd9 226/486: Merge pull request #123 from birkenfeld/fix-unicode-char-escapes, ELPA Syncer, 2021/08/07
- [nongnu] elpa/rust-mode f408b06 227/486: Run the after-revert hook after rustfmt, ELPA Syncer, 2021/08/07