summaryrefslogtreecommitdiff
path: root/rust-mode.el
diff options
context:
space:
mode:
authorTom Tromey <tom@tromey.com>2015-05-27 09:48:06 -0600
committerTom Tromey <tom@tromey.com>2015-08-20 09:40:45 -0600
commit866df37ca517ccdb381d1e431dd5dff52e303430 (patch)
tree284ef740bbd2664b5b6c9f7285e3b5b52abe8328 /rust-mode.el
parent012537b6c915afedaa458642bd23b0937b11d6b1 (diff)
downloadrust-mode-866df37ca517ccdb381d1e431dd5dff52e303430.tar.gz
make rust-mode use lexical binding
Emacs 24 introduces lexical binding, which should be preferred for new code. This enables it for rust-mode. The code continues to work fine on pre-24 Emacs, and it won't be difficult for this to remain true. One concrete advantage of lexical binding is that it lets the byte-compiler generate better warnings in some cases; here it found a couple of unused variables.
Diffstat (limited to 'rust-mode.el')
-rw-r--r--rust-mode.el9
1 files changed, 5 insertions, 4 deletions
diff --git a/rust-mode.el b/rust-mode.el
index ff6814b..4ba4c7c 100644
--- a/rust-mode.el
+++ b/rust-mode.el
@@ -1,4 +1,4 @@
-;;; rust-mode.el --- A major emacs mode for editing Rust source code
+;;; rust-mode.el --- A major emacs mode for editing Rust source code -*-lexical-binding: t-*-
;; Version: 0.2.0
;; Author: Mozilla
@@ -12,7 +12,8 @@
(eval-when-compile (require 'misc)
(require 'rx)
- (require 'compile))
+ (require 'compile)
+ (require 'url-vars))
(defvar electric-pair-inhibit-predicate)
@@ -1102,7 +1103,7 @@ This is written mainly to be used as `end-of-defun-function' for Rust."
(progn
(goto-char (match-beginning 0))
;; Go to the closing brace
- (condition-case err
+ (condition-case nil
(forward-sexp)
(scan-error
;; The parentheses are unbalanced; instead of being unable to fontify, just jump to the end of the buffer
@@ -1175,7 +1176,7 @@ This is written mainly to be used as `end-of-defun-function' for Rust."
(error-or-warning "\\(?:[Ee]rror\\|\\([Ww]arning\\)\\)"))
(let ((re (concat "^" file ":" start-line ":" start-col
": " end-line ":" end-col
- " \\(?:[Ee]rror\\|\\([Ww]arning\\)\\):")))
+ " " error-or-warning ":")))
(cons re '(1 (2 . 4) (3 . 5) (6)))))
"Specifications for matching errors in rustc invocations.
See `compilation-error-regexp-alist' for help on their format.")