Skip to content

Commit b4077f8

Browse files
committed
Add `rust-cargo-bin' custom variable.
1 parent 9afe997 commit b4077f8

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

rust-mode.el

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,11 @@ function or trait. When nil, where will be aligned with fn or trait."
149149
:type 'string
150150
:group 'rust-mode)
151151

152+
(defcustom rust-cargo-bin "cargo"
153+
"Path to cargo executable."
154+
:type 'string
155+
:group 'rust-mode)
156+
152157
(defcustom rust-always-locate-project-on-open nil
153158
"Whether to run `cargo locate-project' every time `rust-mode'
154159
is activated."
@@ -1569,7 +1574,7 @@ visit the new file."
15691574
(interactive)
15701575
(when (null rust-buffer-project)
15711576
(rust-update-buffer-project))
1572-
(let* ((args (list "cargo" "clippy" (concat "--manifest-path=" rust-buffer-project)))
1577+
(let* ((args (list rust-cargo-bin "clippy" (concat "--manifest-path=" rust-buffer-project)))
15731578
;; set `compile-command' temporarily so `compile' doesn't
15741579
;; clobber the existing value
15751580
(compile-command (mapconcat #'shell-quote-argument args " ")))
@@ -1581,7 +1586,7 @@ visit the new file."
15811586
(defun rust-buffer-project ()
15821587
"Get project root if possible."
15831588
(with-temp-buffer
1584-
(let ((ret (call-process "cargo" nil t nil "locate-project")))
1589+
(let ((ret (call-process rust-cargo-bin nil t nil "locate-project")))
15851590
(when (/= ret 0)
15861591
(error "`cargo locate-project' returned %s status: %s" ret (buffer-string)))
15871592
(goto-char 0)

0 commit comments

Comments
 (0)