[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/rust-mode d01b382755 4/5: apply minor fixes
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/rust-mode d01b382755 4/5: apply minor fixes |
Date: |
Fri, 19 Aug 2022 08:59:50 -0400 (EDT) |
branch: elpa/rust-mode
commit d01b3827552098872ad17395e713788ab4cfbc2e
Author: brotzeit <brotzeitmacher@gmail.com>
Commit: brotzeit <brotzeitmacher@gmail.com>
apply minor fixes
---
rust-mode.el | 50 ++++++++++++++++++++++++--------------------------
rust-rustfmt.el | 10 +++++-----
2 files changed, 29 insertions(+), 31 deletions(-)
diff --git a/rust-mode.el b/rust-mode.el
index dda79942e2..997f2b1cf7 100644
--- a/rust-mode.el
+++ b/rust-mode.el
@@ -236,15 +236,15 @@ See `prettify-symbols-compose-predicate'."
(defvar rust-mode-map
(let ((map (make-sparse-keymap)))
- (define-key map (kbd "C-c C-d") 'rust-dbg-wrap-or-unwrap)
+ (define-key map (kbd "C-c C-d") #'rust-dbg-wrap-or-unwrap)
(when rust-load-optional-libraries
- (define-key map (kbd "C-c C-c C-u") 'rust-compile)
- (define-key map (kbd "C-c C-c C-k") 'rust-check)
- (define-key map (kbd "C-c C-c C-t") 'rust-test)
- (define-key map (kbd "C-c C-c C-r") 'rust-run)
- (define-key map (kbd "C-c C-c C-l") 'rust-run-clippy)
- (define-key map (kbd "C-c C-f") 'rust-format-buffer)
- (define-key map (kbd "C-c C-n") 'rust-goto-format-problem))
+ (define-key map (kbd "C-c C-c C-u") #'rust-compile)
+ (define-key map (kbd "C-c C-c C-k") #'rust-check)
+ (define-key map (kbd "C-c C-c C-t") #'rust-test)
+ (define-key map (kbd "C-c C-c C-r") #'rust-run)
+ (define-key map (kbd "C-c C-c C-l") #'rust-run-clippy)
+ (define-key map (kbd "C-c C-f") #'rust-format-buffer)
+ (define-key map (kbd "C-c C-n") #'rust-goto-format-problem))
map)
"Keymap for Rust major mode.")
@@ -286,21 +286,22 @@ See `prettify-symbols-compose-predicate'."
comment-start-skip
"\\|\\*/?[[:space:]]*\\|\\)$"))
(setq-local paragraph-separate paragraph-start)
- (setq-local normal-auto-fill-function 'rust-do-auto-fill)
- (setq-local fill-paragraph-function 'rust-fill-paragraph)
- (setq-local fill-forward-paragraph-function 'rust-fill-forward-paragraph)
- (setq-local adaptive-fill-function 'rust-find-fill-prefix)
+ (setq-local normal-auto-fill-function #'rust-do-auto-fill)
+ (setq-local fill-paragraph-function #'rust-fill-paragraph)
+ (setq-local fill-forward-paragraph-function #'rust-fill-forward-paragraph)
+ (setq-local adaptive-fill-function #'rust-find-fill-prefix)
(setq-local adaptive-fill-first-line-regexp "")
(setq-local comment-multi-line t)
- (setq-local comment-line-break-function 'rust-comment-indent-new-line)
+ (setq-local comment-line-break-function #'rust-comment-indent-new-line)
(setq-local imenu-generic-expression rust-imenu-generic-expression)
(setq-local imenu-syntax-alist '((?! . "w"))) ; For macro_rules!
- (setq-local beginning-of-defun-function 'rust-beginning-of-defun)
- (setq-local end-of-defun-function 'rust-end-of-defun)
+ (setq-local beginning-of-defun-function #'rust-beginning-of-defun)
+ (setq-local end-of-defun-function #'rust-end-of-defun)
(setq-local parse-sexp-lookup-properties t)
(setq-local electric-pair-inhibit-predicate
- 'rust-electric-pair-inhibit-predicate-wrap)
- (setq-local electric-pair-skip-self 'rust-electric-pair-skip-self-wrap)
+ #'rust-electric-pair-inhibit-predicate-wrap)
+ (add-function :before-until (local 'electric-pair-skip-self)
+ #'rust-electric-pair-skip-self)
;; Configure prettify
(setq prettify-symbols-alist rust-prettify-symbols-alist)
(setq prettify-symbols-compose-predicate #'rust--prettify-symbols-compose-p)
@@ -1317,13 +1318,10 @@ This wraps the default defined by
`electric-pair-inhibit-predicate'."
(rust-is-lt-char-operator)))
(funcall (default-value 'electric-pair-inhibit-predicate) char)))
-(defun rust-electric-pair-skip-self-wrap (char)
+(defun rust-electric-pair-skip-self (char)
"Skip CHAR instead of inserting a second closing character.
-This wraps the default defined by `electric-pair-skip-self'."
- (or
- (= ?> char)
- (let ((skip-self (default-value 'electric-pair-skip-self)))
- (and skip-self (funcall skip-self char)))))
+This is added to the default skips defined by `electric-pair-skip-self'."
+ (= ?> char))
(defun rust-ordinary-lt-gt-p ()
"Test whether the `<' or `>' at point is an ordinary operator of some kind.
@@ -1543,10 +1541,10 @@ This handles multi-line comments with a * prefix on
each line."
(lambda ()
(let
((fill-paragraph-function
- (if (not (eq fill-paragraph-function 'rust-fill-paragraph))
+ (if (not (eq fill-paragraph-function #'rust-fill-paragraph))
fill-paragraph-function))
(fill-paragraph-handle-comment t))
- (apply 'fill-paragraph args)
+ (apply #'fill-paragraph args)
t))))))
(defun rust-do-auto-fill (&rest args)
@@ -1554,7 +1552,7 @@ This handles multi-line comments with a * prefix on each
line."
This handles multi-line comments with a * prefix on each line."
(rust-with-comment-fill-prefix
(lambda ()
- (apply 'do-auto-fill args)
+ (apply #'do-auto-fill args)
t)))
(defun rust-fill-forward-paragraph (arg)
diff --git a/rust-rustfmt.el b/rust-rustfmt.el
index 025ec32a8f..bb8864728c 100644
--- a/rust-rustfmt.el
+++ b/rust-rustfmt.el
@@ -47,7 +47,7 @@
(erase-buffer)
(insert-buffer-substring buf)
(let* ((tmpf (make-temp-file "rustfmt"))
- (ret (apply 'call-process-region
+ (ret (apply #'call-process-region
(point-min)
(point-max)
rust-rustfmt-bin
@@ -152,7 +152,7 @@ rustfmt complain in the echo area."
(defconst rust--format-word "\
\\b\\(else\\|enum\\|fn\\|for\\|if\\|let\\|loop\\|\
match\\|struct\\|union\\|unsafe\\|while\\)\\b")
-(defconst rust--format-line "\\([\n]\\)")
+(defconst rust--format-line "\\(\n\\)")
;; Counts number of matches of regex beginning up to max-beginning,
;; leaving the point at the beginning of the last match.
@@ -239,7 +239,7 @@ match\\|struct\\|union\\|unsafe\\|while\\)\\b")
Return the created process."
(interactive)
(unless (executable-find rust-rustfmt-bin)
- (error "Could not locate executable \%s\"" rust-rustfmt-bin))
+ (error "Could not locate executable %S" rust-rustfmt-bin))
(let* ((buffer
(with-current-buffer
(get-buffer-create "*rustfmt-diff*")
@@ -247,14 +247,14 @@ Return the created process."
(erase-buffer))
(current-buffer)))
(proc
- (apply 'start-process
+ (apply #'start-process
"rustfmt-diff"
buffer
rust-rustfmt-bin
"--check"
(cons (buffer-file-name)
rust-rustfmt-switches))))
- (set-process-sentinel proc 'rust-format-diff-buffer-sentinel)
+ (set-process-sentinel proc #'rust-format-diff-buffer-sentinel)
proc))
(defun rust-format-diff-buffer-sentinel (process _e)