Skip to content

Commit ca4fafe

Browse files
committed
Change implementation to use a list of default arguments
1 parent 26dd5ac commit ca4fafe

File tree

1 file changed

+11
-9
lines changed

1 file changed

+11
-9
lines changed

rust-cargo.el

+11-9
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,11 @@
1919
:type 'boolean
2020
:group 'rust-mode)
2121

22-
(defcustom rust-locate-project-in-workspace t
23-
"Whether to use `--workspace` with `cargo locate-project`. If t,
24-
rust-mode will run commands for the entire workspace. If nil,
25-
rust will search for the Cargo.toml in the local crated"
26-
:type 'boolean
22+
(defcustom rust-cargo-locate-default-arguments '("--workspace")
23+
"Arguments for `cargo locate-project`. Remove `--workspace` if you
24+
would prefer to use the local crate Cargo.toml instead of the
25+
worksapce for commands like `cargo check`."
26+
:type '(repeat string)
2727
:group 'rust-mode)
2828

2929
(defcustom rust-cargo-default-arguments ""
@@ -50,10 +50,12 @@
5050
;; Set PATH so we can find cargo.
5151
(setq-local exec-path path)
5252
(let ((ret
53-
(let ((args (list rust-cargo-bin nil (list (current-buffer) nil) nil "locate-project")))
54-
(when rust-locate-project-in-workspace
55-
(setq args (append args (list "--workspace"))))
56-
(apply #'process-file args))))
53+
(let ((args
54+
(append
55+
(list rust-cargo-bin nil (list (current-buffer) nil) nil
56+
"locate-project")
57+
rust-cargo-locate-default-arguments)))
58+
(apply #'process-file args))))
5759
(when (/= ret 0)
5860
(error "`cargo locate-project' returned %s status: %s" ret (buffer-string)))
5961
(goto-char 0)

0 commit comments

Comments
 (0)