Comments (13)
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.
from cargo-machete.
https://git.sr.ht/~dmerej/skyspell/commit/722c4eeb302df160d5dc973f571516b03699e9a5
It works !
from cargo-machete.
A colleague used cargo machete
to remove dozens of unused dependencies from our project
Thank you!!
from cargo-machete.
I has been useful, yes: ruffle-rs/ruffle#15774 :)
from cargo-machete.
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
from cargo-machete.
✨ 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)
from cargo-machete.
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!
from cargo-machete.
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.
from cargo-machete.
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 bycargo hakari
), so I added the ignore to everyCargo.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
andserde
. - 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.
from cargo-machete.
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 🎉
from cargo-machete.
from cargo-machete.
Been using cargo machete for https://github.com/IgnisDa/ryot for over a year. Really useful tool.
Also love the name!
from cargo-machete.
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!
from cargo-machete.
Related Issues (20)
- Feature Request: Optimize [build-dependencies] as well HOT 2
- [bug] missing field `version` - should not report HOT 6
- No logo / mascot HOT 1
- Investigate Nightly CI failure
- Is there a way to ignore a workspace member crate? HOT 2
- Github Action fails in CI on windows-latest HOT 2
- Falso positive when package name and lib name differ HOT 3
- [Rust 1.77.0] cargo machete --with-metadata panicking HOT 2
- Feature Idea: Centralized config file HOT 1
- --with-metadata false positive with build-dependencies HOT 2
- When no issues are found report message is incomplete.
- Add a benchmark
- `--with-metadata` does not correctly analyze build scripts HOT 1
- Related dependencies are signed as unused but they are not HOT 3
- Make github action take a `working_dir` argument HOT 1
- False positive for macros HOT 2
- bug: No such file or directory error on mac
- Support for skipping sub-directories HOT 1
- Respect the `members` field of a workspace Cargo.toml HOT 2
- actions-rs/cargo@v1 use Node12. Please update the following actions to use Node.js 16 HOT 8
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cargo-machete.