diff options
| author | jao <jao@gnu.org> | 2026-03-25 23:43:34 +0000 |
|---|---|---|
| committer | jao <jao@gnu.org> | 2026-03-25 23:45:20 +0000 |
| commit | d5a102ea3527b6037469ab9f9798d709d3e032d0 (patch) | |
| tree | 462eb6b03210280d272b3e98522187547a1ffdc2 /lib/prog/jao-rust.el | |
| parent | 5c11fc1947560a1535cf093e1fbab241b4412a97 (diff) | |
| download | elibs-d5a102ea3527b6037469ab9f9798d709d3e032d0.tar.gz elibs-d5a102ea3527b6037469ab9f9798d709d3e032d0.tar.bz2 | |
rust tweaks
Diffstat (limited to 'lib/prog/jao-rust.el')
| -rw-r--r-- | lib/prog/jao-rust.el | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/lib/prog/jao-rust.el b/lib/prog/jao-rust.el index fdc6b0d..436de00 100644 --- a/lib/prog/jao-rust.el +++ b/lib/prog/jao-rust.el @@ -20,7 +20,8 @@ ;;; Code: -(defun jao-rust--root () (project-root (project-current))) +(defun jao-rust--root () + (locate-dominating-file default-directory "Cargo.toml")) (defun jao-rust-open-cargo () (interactive) @@ -54,6 +55,15 @@ (forward-line) (jao-rust-test-at-point)))) + +(defconst jao-rust--tests-mod-rx "^\\(pub\\)? *mod tests {") + +(defun jao-rust-goto-tests () + (interactive) + (or (re-search-forward jao-rust--tests-mod-rx nil t) + (re-search-backward jao-rust--tests-mod-rx nil t) + (message "No tests module"))) + (defun jao-rust-test-current () (interactive) (if-let* ((m (jao-rust-current-module-name)) @@ -83,10 +93,21 @@ (rustic-cargo-use-last-stored-arguments t)) (rustic-cargo-test))))) +(defun jao-rust-retest () + (interactive) + (let* ((rustic-test-arguments "-R latest") + (rustic-cargo-use-last-stored-arguments t)) + (rustic-cargo-test))) + (defun jao-rust-test-workspace () (interactive) (let ((rustic-test-arguments rustic-default-test-arguments)) (rustic-cargo-test))) + +(defun jao-rust-build-doc (deps) + (interactive "P") + (rustic-run-cargo-command `(,(rustic-cargo-bin) "doc" ,@(unless deps '("--no-deps"))))) + (provide 'jao-rust) ;;; jao-rust.el ends here |
