File tree Expand file tree Collapse file tree 3 files changed +19
-1
lines changed Expand file tree Collapse file tree 3 files changed +19
-1
lines changed Original file line number Diff line number Diff line change 2121 (find-file main-file)
2222 , expr )))
2323
24+ (defmacro rust-test--with-edition-2015-file-buffer (expr )
25+ `(let* ((test-dir (expand-file-name " test-project/" default-directory))
26+ (main-file (expand-file-name " src/edition-2015.rs" test-dir)))
27+ (save-current-buffer
28+ (find-file main-file)
29+ , expr )))
30+
2431(defun rust-test--find-string (string )
2532 " Find STRING in current buffer."
2633 (goto-char (point-min ))
7077 (should (eq major-mode 'rust-format-mode ))
7178 (should (rust-test--find-string " error:" )))
7279 (kill-buffer " *rustfmt*" )))
80+
81+ (ert-deftest rust-test-rustfmt-ensure-edition-2015 ()
82+ (skip-unless (executable-find " rustfmt" ))
83+ (rust-test--with-edition-2015-file-buffer
84+ (let ((old-content (buffer-string ))
85+ (ret (rust-format-buffer)))
86+ (should (string= old-content (buffer-string ))))))
Original file line number Diff line number Diff line change 3333 :type 'string
3434 :group 'rust-mode )
3535
36- (defcustom rust-rustfmt-switches '( " --edition " " 2024 " )
36+ (defcustom rust-rustfmt-switches nil
3737 " Arguments to pass when invoking the `rustfmt' executable."
3838 :type '(repeat string)
3939 :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 with its default --edition=2015
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