-
Notifications
You must be signed in to change notification settings - Fork 2.7k
docs(guide): Point out tools for reducing dependencies #16078
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -86,6 +86,24 @@ Trade-offs: | |
| - ✅ Faster build times | ||
| - ❌ **Requires using nightly Rust and an [unstable Rust feature][parallel-frontend-issue]** | ||
|
|
||
| ## Reducing built code | ||
|
|
||
| ### Removing unused dependencies | ||
|
|
||
| Recommendation: Periodically review unused dependencies for removal using third-party tools like | ||
| [cargo-machete](https://crates.io/crates/cargo-machete), | ||
| [cargo-udeps](https://crates.io/crates/cargo-udeps), | ||
| [cargo-shear](https://crates.io/crates/cargo-shear). | ||
|
|
||
| When changing code, | ||
| it can be easy to miss that a dependency is no longer used and can be removed. | ||
|
|
||
| > *Note:* native support for this in Cargo is being tracked in [#15813](https://github.com/rust-lang/cargo/issues/15813). | ||
|
|
||
| Trade-offs: | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not sure how much the trade-offs section makes sense here, as it's not a config that you would apply and it then affects your crate, but rather you just use a tool that might have false negatives/positives, and that's about it. But I also don't think it's super important. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It provided a nice place to
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sure, fair enough :) |
||
| - ✅ Faster full build and link times | ||
| - ❌ May incorrectly flag dependencies as unused or miss some | ||
|
|
||
| [parallel-frontend-blog]: https://blog.rust-lang.org/2023/11/09/parallel-rustc/ | ||
| [parallel-frontend-issue]: https://github.com/rust-lang/rust/issues/113349 | ||
| [build.rustflags]: ../reference/config.md#buildrustflags | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: We normally use bold for note