summaryrefslogtreecommitdiff
path: root/rust-mode.el
diff options
context:
space:
mode:
authorChristian Howe <cjhowe7@gmail.com>2017-04-23 18:29:53 -0400
committerChristian Howe <cjhowe7@gmail.com>2017-04-23 18:29:53 -0400
commit0256f0290e5c79d124530b6b621d2a6fc5a19bf4 (patch)
tree9588154e2a1250eca9e51ff765e13b8a3d61b556 /rust-mode.el
parent491ae0ed45131433a689ccd724358d0ee40f234c (diff)
downloadrust-mode-0256f0290e5c79d124530b6b621d2a6fc5a19bf4.tar.gz
Fix stupid mistake in rustfmt conditional
Diffstat (limited to 'rust-mode.el')
-rw-r--r--rust-mode.el10
1 files changed, 5 insertions, 5 deletions
diff --git a/rust-mode.el b/rust-mode.el
index 3b4b665..a2b5fc5 100644
--- a/rust-mode.el
+++ b/rust-mode.el
@@ -1200,7 +1200,10 @@ This is written mainly to be used as `end-of-defun-function' for Rust."
t `(t ,tmpf) nil)))
(cond
((zerop ret)
- (error "Rustfmt failed, see *rustfmt* buffer for details"))
+ (if (not (string= (buffer-string)
+ (with-current-buffer buf (buffer-string))))
+ (copy-to-buffer buf (point-min) (point-max)))
+ (kill-buffer))
((= ret 3)
(if (not (string= (buffer-string)
(with-current-buffer buf (buffer-string))))
@@ -1209,10 +1212,7 @@ This is written mainly to be used as `end-of-defun-function' for Rust."
(insert-file-contents tmpf)
(error "Rustfmt could not format some lines, see *rustfmt* buffer for details"))
(t
- (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]\\)")