est31 / cargo-udeps

Find unused dependencies in Cargo.toml
Other
1.76k stars 46 forks source link

How to launch cargo-udeps? #85

Closed sanpii closed 3 years ago

sanpii commented 3 years ago

Hello,

When I run the installed version of cargo-udeps (from archlinux package) it fails:

~/sources/cargo-udeps ((v0.1.16))$ cargo +nightly udeps
Error: StrErr("failed to parse lock file at: /home/sanpi/sources/cargo-udeps/Cargo.lock")

But it works when I run the same version from sources:

~/sources/cargo-udeps ((v0.1.16))$ cargo +nightly run --locked --release -- udeps
    Finished release [optimized] target(s) in 0.06s
     Running `target/release/cargo-udeps udeps`
    Checking cargo-udeps v0.1.16 (/home/sanpi/sources/cargo-udeps)
    Finished dev [unoptimized] target(s) in 0.52s
info: Loading save analysis from "/home/sanpi/sources/cargo-udeps/target/debug/deps/save-analysis/libcargo_udeps-1d37ace45aeb7ff4.json"
info: Loading save analysis from "/home/sanpi/sources/cargo-udeps/target/debug/deps/save-analysis/cargo_udeps-cc9723783a4a9ea9.json"
All deps seem to have been used.
$ cargo --version
cargo 1.49.0 (d00d64df9 2020-12-05)

What did I miss?

est31 commented 3 years ago

It seems you are using an old cargo-udeps version. StrErr has been removed a long time ago I think. I think running cargo install cargo-udeps to update the installed version should fix it.

qryxip commented 3 years ago

The AUR package seems to fetch the latest cargo-udeps. Try updating the package.

❯ yay -Su cargo-udeps
est31 commented 3 years ago

Oh I missed that they got it from AUR. Yeah of course then it's better to keep using the package. I checked the AUR website, they seem to have packaged the latest version.

sanpii commented 3 years ago

Thank you for your help. I found the guilty in my cargo home (probably an old cargo install artefact).