Skip to content

Commit d00d83d

Browse files
authored
Merge pull request #546 from bradneuman/workspace-local
Adds a customization to default to workspace or local crate.
2 parents 5e96cd0 + ca4fafe commit d00d83d

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

rust-cargo.el

+14-1
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,13 @@
1919
:type 'boolean
2020
:group 'rust-mode)
2121

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)
27+
:group 'rust-mode)
28+
2229
(defcustom rust-cargo-default-arguments ""
2330
"Default arguments when running common cargo commands."
2431
:type 'string
@@ -42,7 +49,13 @@
4249
(setq-local process-environment env)
4350
;; Set PATH so we can find cargo.
4451
(setq-local exec-path path)
45-
(let ((ret (process-file rust-cargo-bin nil (list (current-buffer) nil) nil "locate-project" "--workspace")))
52+
(let ((ret
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))))
4659
(when (/= ret 0)
4760
(error "`cargo locate-project' returned %s status: %s" ret (buffer-string)))
4861
(goto-char 0)

0 commit comments

Comments
 (0)