branch: elpa/rust-mode
commit b4077f8be2163b71b33a12932ef1013874646a9c
Author: Aankhen <[email protected]>
Commit: Aankhen <[email protected]>
Add `rust-cargo-bin' custom variable.
---
rust-mode.el | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/rust-mode.el b/rust-mode.el
index a1d98b0..2c58545 100644
--- a/rust-mode.el
+++ b/rust-mode.el
@@ -149,6 +149,11 @@ function or trait. When nil, where will be aligned with
fn or trait."
:type 'string
:group 'rust-mode)
+(defcustom rust-cargo-bin "cargo"
+ "Path to cargo executable."
+ :type 'string
+ :group 'rust-mode)
+
(defcustom rust-always-locate-project-on-open nil
"Whether to run `cargo locate-project' every time `rust-mode'
is activated."
@@ -1569,7 +1574,7 @@ visit the new file."
(interactive)
(when (null rust-buffer-project)
(rust-update-buffer-project))
- (let* ((args (list "cargo" "clippy" (concat "--manifest-path="
rust-buffer-project)))
+ (let* ((args (list rust-cargo-bin "clippy" (concat "--manifest-path="
rust-buffer-project)))
;; set `compile-command' temporarily so `compile' doesn't
;; clobber the existing value
(compile-command (mapconcat #'shell-quote-argument args " ")))
@@ -1581,7 +1586,7 @@ visit the new file."
(defun rust-buffer-project ()
"Get project root if possible."
(with-temp-buffer
- (let ((ret (call-process "cargo" nil t nil "locate-project")))
+ (let ((ret (call-process rust-cargo-bin nil t nil "locate-project")))
(when (/= ret 0)
(error "`cargo locate-project' returned %s status: %s" ret
(buffer-string)))
(goto-char 0)