File tree Expand file tree Collapse file tree 3 files changed +26
-2
lines changed Expand file tree Collapse file tree 3 files changed +26
-2
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-snippet-buffer (expr )
25
+ `(let* ((test-dir (expand-file-name " test-project/" default-directory))
26
+ (snippet-file (expand-file-name " src/rustfmt-default.rs" test-dir)))
27
+ (save-current-buffer
28
+ (find-file snippet-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-respect-rustfmt-defaults ()
82
+ (skip-unless (executable-find " rustfmt" ))
83
+ (rust-test--with-snippet-buffer
84
+ (let ((old-content (buffer-string ))
85
+ (ret (rust-format-buffer)))
86
+ (should (string= old-content (buffer-string ))))))
87
+
88
+ (ert-deftest rust-test-ensure-rustfmt-switches-nil ()
89
+ (should (eq rust-rustfmt-switches nil )))
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" )
37
- " Arguments to pass when invoking the `rustfmt' executable."
36
+ (defcustom rust-rustfmt-switches nil
37
+ " Arguments to pass when invoking the `rustfmt' executable. This variable
38
+ will override any user configuration (e.g. rustfmt.toml). Recommendation
39
+ is to not modify this and rely on declarative configuration instead."
38
40
:type '(repeat string)
39
41
:group 'rust-mode )
40
42
Original file line number Diff line number Diff line change
1
+ // this file ensures that by default rustfmt is invoked without parameters
2
+ // and formats with its default (--edition=2015 as of today)
3
+
4
+ // With --edition=2024 this import will be reordered
5
+ use std:: { i16, i8} ;
You can’t perform that action at this time.
0 commit comments