Skip to content

Commit 6b40446

Browse files
authored
docs(guide): Talk about removing unused features (#16085)
### What does this PR try to resolve? Helps users find ways to identify unused features in dependencies. This also pulls in - General improvements from #15991 (in particular, the grouping of links with content since this was going to make it worse) - Review feedback from #16078 ### How to test and review this PR?
2 parents 3ee4023 + 7187b5e commit 6b40446

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

src/doc/src/guide/build-performance.md

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,8 +122,26 @@ Recommendation: Periodically review unused dependencies for removal using third-
122122
When changing code,
123123
it can be easy to miss that a dependency is no longer used and can be removed.
124124

125-
> *Note:* native support for this in Cargo is being tracked in [#15813](https://github.com/rust-lang/cargo/issues/15813).
125+
> **Note:** native support for this in Cargo is being tracked in [#15813](https://github.com/rust-lang/cargo/issues/15813).
126126
127127
Trade-offs:
128128
- ✅ Faster full build and link times
129129
- ❌ May incorrectly flag dependencies as unused or miss some
130+
131+
### Removing unused features from dependencies
132+
133+
Recommendation: Periodically review unused features from dependencies for removal using third-party tools like
134+
[cargo-features-manager](https://crates.io/crates/cargo-features-manager),
135+
[cargo-unused-features](https://crates.io/crates/cargo-unused-features).
136+
137+
When changing code,
138+
it can be easy to miss that a dependency's feature is no longer used and can be removed.
139+
This can reduce the number of transitive dependencies being built or
140+
reduce the amount of code within a crate being built.
141+
When removing features, extra caution is needed because features
142+
may also be used for desired behavior or performance changes
143+
which may not always be obvious from compiling or testing.
144+
145+
Trade-offs:
146+
- ✅ Faster full build and link times
147+
- ❌ May incorrectly flag features as unused

0 commit comments

Comments
 (0)