Skip to content

Commit 0256f02

Browse files
author
Christian Howe
committed
Fix stupid mistake in rustfmt conditional
1 parent 491ae0e commit 0256f02

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

rust-mode.el

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1200,7 +1200,10 @@ This is written mainly to be used as `end-of-defun-function' for Rust."
12001200
t `(t ,tmpf) nil)))
12011201
(cond
12021202
((zerop ret)
1203-
(error "Rustfmt failed, see *rustfmt* buffer for details"))
1203+
(if (not (string= (buffer-string)
1204+
(with-current-buffer buf (buffer-string))))
1205+
(copy-to-buffer buf (point-min) (point-max)))
1206+
(kill-buffer))
12041207
((= ret 3)
12051208
(if (not (string= (buffer-string)
12061209
(with-current-buffer buf (buffer-string))))
@@ -1209,10 +1212,7 @@ This is written mainly to be used as `end-of-defun-function' for Rust."
12091212
(insert-file-contents tmpf)
12101213
(error "Rustfmt could not format some lines, see *rustfmt* buffer for details"))
12111214
(t
1212-
(if (not (string= (buffer-string)
1213-
(with-current-buffer buf (buffer-string))))
1214-
(copy-to-buffer buf (point-min) (point-max)))
1215-
(kill-buffer)))))))
1215+
(error "Rustfmt failed, see *rustfmt* buffer for details")))))))
12161216

12171217
(defconst rust--format-word "\\b\\(else\\|enum\\|fn\\|for\\|if\\|let\\|loop\\|match\\|struct\\|unsafe\\|while\\)\\b")
12181218
(defconst rust--format-line "\\([\n]\\)")

0 commit comments

Comments
 (0)