Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hall Of Fame ✨ #6

Open
bnjbvr opened this issue Nov 15, 2021 · 13 comments
Open

Hall Of Fame ✨ #6

bnjbvr opened this issue Nov 15, 2021 · 13 comments

Comments

@bnjbvr
Copy link
Owner

bnjbvr commented Nov 15, 2021

If cargo-machete has been useful for you and has helped removing dependencies in your project, feel free to add a comment to this issue :)

@bnjbvr bnjbvr pinned this issue Nov 15, 2021
@dmerejkowsky
Copy link

https://git.sr.ht/~dmerej/skyspell/commit/722c4eeb302df160d5dc973f571516b03699e9a5

It works !

@Veetaha
Copy link

Veetaha commented May 11, 2022

I applied it in a really large cargo workspace in our private repository and it detected like really many unused crates for us!
Our workspace is around 122 crates, and we managed to remove ~187 unused dependencies 🎉!

However, the number of false positives was ~67.

The main problem is that we use a lot of code included from OUT_DIR, which isn't analyzed.

Also, cargo-machete --with-metadata doesn't analyze build.rs tests and other rust files from examples/ directory (also, I am not sure but maybe benches/ directory is not analyzed either?) for some reason (is it broken?)

Also, looks like pub use ::crate_name reference doesn't seem to be picked up by cargo-machete

@Bromeon
Copy link
Contributor

Bromeon commented May 13, 2022

godot-rust/gdnative#890 (revision 84c99b1)

  • 6 unneeded dependencies detected (2 of which between internal crates)
  • 1 false positive (low, since we have a lot of codegen)
  • integrated into CI (very easy now thanks to #25)

@bnjbvr
Copy link
Owner Author

bnjbvr commented May 14, 2022

Also, looks like pub use ::crate_name reference doesn't seem to be picked up by cargo-machete

Ah, looks like an oversight, will add a test and support for that, thanks!

@mickvangelderen
Copy link
Contributor

I've used cargo-machete alongside cargo-udeps to quickly find and remove unneeded dependencies after splitting one crate into multiple crates. I had to manually add some exceptions for dependencies of code generated through build scripts as well but other than that worked great.

@xxchan
Copy link
Contributor

xxchan commented Feb 9, 2023

risingwavelabs/risingwave#7816 It helped a lot! Thanks for the great tool. Tens of udeps are removed.

The commit history in this PR also shows how I used it and the problems I met:

  • We are using workspace-hack (managed by cargo hakari), so I added the ignore to every Cargo.toml. It might be better to have a global config file, e.g., .config/machete.toml
  • One kind of false postive is derive macros, e.g., num_trails and serde.
  • Another "false postive" is conditional compilation. But maybe we should have just uses [target.'cfg(target_os = "linux")'.dependencies]

Also, cargo-machete --with-metadata reports something like error: current package believes it's in a workspace when it's not. It may be because we wrongly configured some crates, but I didn't bother to fix it. Fortunately it turns out there aren't many false-postives.

@azzamsa
Copy link

azzamsa commented Jul 27, 2023

I'm facing difficulties while trying to install cargo-udeps, as it seems to depend on libssl.so.1.1. I've already installed several SSL-related dependencies on both Ubuntu 22.04 and Debian 12, but I haven't been successful so far.

As a last resort, I'm considering installing libssl.so.1.1 on an Arch container using Distrobox. However, I'm also open to exploring alternatives. Surprisingly, cargo-machete managed to find what cargo-udeps couldn't. 🏆

monorepo-services/alibaba on  alibaba/refactor [!?] is 📦 v0.4.0 via 🦀 v1.71.0
# `cargo-udeps`
    Checking hyosho v0.4.0 (/home/user/projects/monorepo-services/alibaba)
    Finished dev [unoptimized + debuginfo] target(s) in 1.63s
info: Loading depinfo from "/home/user/projects/monorepo-services/alibaba/target/debug/deps/hyosho-14768cb6b
da7830f.d"
info: Loading depinfo from "/home/user/projects/monorepo-services/alibaba/target/debug/deps/hyosho-bc29a72ec
262bf2e.d"
All deps seem to have been used.

# `cargo-machete`
Analyzing dependencies of crates in this directory...
cargo-machete found the following unused dependencies in /home/user/projects/monorepo-services/alibaba:
hyosho -- /home/user/projects/monorepo-services/alibaba/Cargo.toml:
        rand
        url
Done!

@randombit
Copy link

A colleague used cargo machete to remove dozens of unused dependencies from our project

dfinity/ic@a3b6beb

Thank you!!

@poliorcetics
Copy link
Contributor

No public code to show off but cargo machete worked like a charm and managed to find 2 unused deps (including one on an internal crate) which let me remove a build-script, always nice for small compile times wins 🎉

@kvark
Copy link

kvark commented Feb 27, 2024

I finished cleaning up Zed - zed-industries/zed#8468
In a series of 4 PR, around 600 LOC were removed from Cargo.lock with many unused dependencies.
In the meantime,

And cargo-udeps shows me that All deps seem to have been used., now I'm convinced to remove it.

@torokati44
Copy link

I has been useful, yes: ruffle-rs/ruffle#15774 :)

@IgnisDa
Copy link

IgnisDa commented Jun 18, 2024

Been using cargo machete for https://github.com/IgnisDa/ryot for over a year. Really useful tool.

Also love the name!

@larseggert
Copy link

mozilla/neqo#1974

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests