summaryrefslogtreecommitdiff
path: root/rust-cargo.el
diff options
context:
space:
mode:
authorbrotzeit <brotzeitmacher@gmail.com>2022-02-03 19:31:52 +0100
committerbrotzeit <brotzeitmacher@gmail.com>2022-02-03 19:32:30 +0100
commit832980d96a3b7e985bc8bfb1dc2bd7e9599c6312 (patch)
tree80c1360aa28000b872bd2d05efd58fdb4f069331 /rust-cargo.el
parent07e1e0aa2f750da0a73d95e45eb474b54031d2a0 (diff)
downloadrust-mode-832980d96a3b7e985bc8bfb1dc2bd7e9599c6312.tar.gz
allow setting additional args with rust-cargo-default-arguments
Diffstat (limited to 'rust-cargo.el')
-rw-r--r--rust-cargo.el13
1 files changed, 9 insertions, 4 deletions
diff --git a/rust-cargo.el b/rust-cargo.el
index 30ba611..58f0151 100644
--- a/rust-cargo.el
+++ b/rust-cargo.el
@@ -19,6 +19,11 @@
:type 'boolean
:group 'rust-mode)
+(defcustom rust-cargo-default-arguments ""
+ "Default arguments when running common cargo commands."
+ :type 'string
+ :group 'rust-mode)
+
;;; Buffer Project
(defvar-local rust-buffer-project nil)
@@ -59,12 +64,12 @@
(defun rust-check ()
"Compile using `cargo check`"
(interactive)
- (rust--compile "%s check" rust-cargo-bin))
+ (rust--compile "%s check %s" rust-cargo-bin rust-cargo-default-arguments))
(defun rust-compile ()
"Compile using `cargo build`"
(interactive)
- (rust--compile "%s build" rust-cargo-bin))
+ (rust--compile "%s build %s" rust-cargo-bin rust-cargo-default-arguments))
(defun rust-compile-release ()
"Compile using `cargo build --release`"
@@ -74,7 +79,7 @@
(defun rust-run ()
"Run using `cargo run`"
(interactive)
- (rust--compile "%s run" rust-cargo-bin))
+ (rust--compile "%s run %s" rust-cargo-bin rust-cargo-default-arguments))
(defun rust-run-release ()
"Run using `cargo run --release`"
@@ -84,7 +89,7 @@
(defun rust-test ()
"Test using `cargo test`"
(interactive)
- (rust--compile "%s test" rust-cargo-bin))
+ (rust--compile "%s test %s" rust-cargo-bin rust-cargo-default-arguments))
(defun rust-run-clippy ()
"Run `cargo clippy'."