Skip to content

Commit 3fd442b

Browse files
committed
Add support for it in clippy and test too
1 parent 25995a2 commit 3fd442b

File tree

3 files changed

+7
-4
lines changed

3 files changed

+7
-4
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -529,6 +529,7 @@ Customization:
529529
- `rustic-cargo-auto-add-missing-dependencies` automatically add missing dependencies
530530
to Cargo.toml by checking new diagnostics for 'unresolved import' errors
531531
- `rustic-cargo-use-last-stored-arguments` always use stored arguments that were provided with `C-u`(instead of requiring to run rustic "rerun" commands)
532+
- `rustic-cargo-populate-package-name` for auto populating the correct package name when used with universal argument. This comes in handy when you are working with multiple projects. Not enabled by default, but recommened to enable it.
532533

533534
### Edit
534535

rustic-cargo.el

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@
4949
:type 'string
5050
:group 'rustic-cargo)
5151

52-
(defcustom rustic-populate-package-name t
52+
(defcustom rustic-cargo-populate-package-name nil
5353
"Populate package name automatically when used with universal argument."
5454
:type 'boolean
5555
:group 'rustic-cargo)
@@ -66,7 +66,7 @@
6666
(gethash default-directory rustic--package-names)))))
6767

6868
(defun rustic-cargo-package-argument ()
69-
(if rustic-populate-package-name
69+
(if rustic-cargo-populate-package-name
7070
(let ((package-name (rustic-cargo-cached-package-name)))
7171
(when package-name
7272
(format "--package %s" package-name)))))
@@ -76,7 +76,7 @@
7676
(if buffer
7777
(kill-buffer buffer)))
7878
(let* ((buffer (get-buffer-create "*cargo-manifest*"))
79-
(exit-code (call-process "cargo" nil buffer nil "read-manifest")))
79+
(exit-code (call-process (rustic-cargo-bin) nil buffer nil "read-manifest")))
8080
(if (eq exit-code 0)
8181
(with-current-buffer buffer
8282
(let ((json-parsed-data (json-read-from-string (buffer-string))))
@@ -220,7 +220,8 @@ If ARG is not nil, use value as argument and store it in
220220
(setq rustic-test-arguments
221221
(read-from-minibuffer "Cargo test arguments: "
222222
(rustic--populate-minibuffer
223-
(list rustic-test-arguments
223+
(list (rustic-cargo-package-argument)
224+
rustic-test-arguments
224225
rustic-cargo-build-arguments
225226
rustic-default-test-arguments)))))
226227
(rustic-cargo-test-run rustic-test-arguments))

rustic-clippy.el

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ When calling this function from `rustic-popup-mode', always use the value of
8484
(read-from-minibuffer "Cargo clippy arguments: "
8585
(rustic--populate-minibuffer
8686
(list
87+
(rustic-cargo-package-argument)
8788
rustic-clippy-arguments
8889
rustic-cargo-build-arguments
8990
rustic-default-clippy-arguments

0 commit comments

Comments
 (0)