Skip to content

Commit b4a60aa

Browse files
committed
docs(guide): Talk about removing unused features
1 parent 0e00b14 commit b4a60aa

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

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

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,3 +127,21 @@ it can be easy to miss that a dependency is no longer used and can be removed.
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 reduced 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)