File tree Expand file tree Collapse file tree 3 files changed +20
-1
lines changed Expand file tree Collapse file tree 3 files changed +20
-1
lines changed Original file line number Diff line number Diff line change 21
21
(find-file main-file)
22
22
, expr )))
23
23
24
+ (defmacro rust-test--with-edition-2018-file-buffer (expr )
25
+ `(let* ((test-dir (expand-file-name " test-project/" default-directory))
26
+ (main-file (expand-file-name " src/edition-2018.rs" test-dir)))
27
+ (save-current-buffer
28
+ (find-file main-file)
29
+ , expr )))
30
+
24
31
(defun rust-test--find-string (string )
25
32
" Find STRING in current buffer."
26
33
(goto-char (point-min ))
70
77
(should (eq major-mode 'rust-format-mode ))
71
78
(should (rust-test--find-string " error:" )))
72
79
(kill-buffer " *rustfmt*" )))
80
+
81
+ (ert-deftest rust-test-rustfmt-2018 ()
82
+ (skip-unless (executable-find " rustfmt" ))
83
+ (rust-test--with-edition-2018-file-buffer
84
+ (let ((old-content (buffer-string ))
85
+ (ret (rust-format-buffer)))
86
+ (should (string= ret " Formatted buffer with rustfmt." ))
87
+ (should (string= old-content (buffer-string ))))))
Original file line number Diff line number Diff line change 33
33
:type 'string
34
34
:group 'rust-mode )
35
35
36
- (defcustom rust-rustfmt-switches '( " --edition " " 2024 " )
36
+ (defcustom rust-rustfmt-switches nil
37
37
" Arguments to pass when invoking the `rustfmt' executable."
38
38
:type '(repeat string)
39
39
:group 'rust-mode )
Original file line number Diff line number Diff line change
1
+ // this test ensures that by default rustfmt is invoked without parameters
2
+ // and formats for --edition=2018
3
+ // (with --edition=2024 this import would be reordered)
4
+ use anyhow:: { anyhow, Context } ;
You can’t perform that action at this time.
0 commit comments