Skip to content

Commit

Permalink
Fix non-interactive use of cargo-find-dependency
Browse files Browse the repository at this point in the history
* cargo.el (cargo-find-dependency): fetch metadata if the metadata
argument is nil.
  • Loading branch information
nemethf committed Mar 5, 2022
1 parent a500fd2 commit 89bc407
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion cargo.el
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,11 @@ If METADATA is non-nil, use that instead of fetching it with cargo."
"Dependency: " crates nil t nil nil (symbol-at-point))
metadata)))
(let ((filenames
(cl-loop for pkg in (append (alist-get 'packages metadata) nil)
(cl-loop for pkg in (append
(alist-get 'packages
(or metadata
(cargo-process--get-metadata)))
nil)
when (equal crate (alist-get 'name pkg))
collect (alist-get 'manifest_path pkg)))
;; Directly `find-file' if there's just a single match.
Expand Down

0 comments on commit 89bc407

Please sign in to comment.