Add cargo-machete and remove unnecessary dependencies 🔪 #890
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
cargo-machete is a tool designed to detect unnecessary dependencies in Rust crates. Having a similar goal as cargo-udep, it chooses some different trade-offs, which are explained in the blog post.
In godot-rust, machete detected 6 cases of unnecessary dependencies (of which 2 are between internal crates). I automated checks via CI action, which runs in less than a second -- most time is spent on
cargo install
, which is cached when possible. I needed to highlight one false positive (libc
), which is fortunately a well-supported feature of machete. With the amount of proc-macros and code generation we deal with, I was surprised it wasn't more.This addition should help us detect dependencies which are no longer needed, and slightly reduce initial compile time. It won't have a big effect on incremental compilation. We may need to monitor in the coming weeks if the removed dependencies cause issues in one way or another -- that would however also highlight a lack of coverage in our CI pipeline.
bors try