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

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

[nongnu] elpa/rust-mode 367a89c 299/486: Allow formatting with long line


From: ELPA Syncer
Subject: [nongnu] elpa/rust-mode 367a89c 299/486: Allow formatting with long lines
Date: Sat, 7 Aug 2021 09:25:40 -0400 (EDT)

branch: elpa/rust-mode
commit 367a89c423481db18ab1dd346f5b389ca392a69e
Author: Christian Howe <cjhowe7@gmail.com>
Commit: Christian Howe <cjhowe7@gmail.com>

    Allow formatting with long lines
---
 rust-mode.el | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/rust-mode.el b/rust-mode.el
index f1c3994..1fce291 100644
--- a/rust-mode.el
+++ b/rust-mode.el
@@ -1195,12 +1195,13 @@ This is written mainly to be used as 
`end-of-defun-function' for Rust."
   (with-current-buffer (get-buffer-create "*rustfmt*")
     (erase-buffer)
     (insert-buffer-substring buf)
-    (if (zerop (call-process-region (point-min) (point-max) rust-rustfmt-bin t 
t nil))
-        (progn
-          (if (not (string= (buffer-string) (with-current-buffer buf 
(buffer-string))))
-              (copy-to-buffer buf (point-min) (point-max)))
-          (kill-buffer))
-      (error "Rustfmt failed, see *rustfmt* buffer for details"))))
+    (let ((ret (call-process-region (point-min) (point-max) rust-rustfmt-bin t 
'(t nil) nil)))
+      (if (or (zerop ret) (= ret 3))
+          (progn
+            (if (not (string= (buffer-string) (with-current-buffer buf 
(buffer-string))))
+                (copy-to-buffer buf (point-min) (point-max)))
+            (kill-buffer))
+        (error "Rustfmt failed, see *rustfmt* buffer for details")))))
 
 (defconst rust--format-word 
"\\b\\(else\\|enum\\|fn\\|for\\|if\\|let\\|loop\\|match\\|struct\\|unsafe\\|while\\)\\b")
 (defconst rust--format-line "\\([\n]\\)")



reply via email to

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