Skip to content

Commit 5905eba

Browse files
committed
docs(guide): Talk about removing unused features
1 parent 6575d01 commit 5905eba

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
@@ -107,3 +107,21 @@ it can be easy to miss that a dependency is no longer used and can be removed.
107107
Trade-offs:
108108
- ✅ Faster full build and link times
109109
- ❌ May incorrectly flag dependencies as unused or miss some
110+
111+
### Removing unused features from dependencies
112+
113+
Recommendation: Periodically review unused features from dependencies for removal using third-party tools like
114+
[cargo-features-manager](https://crates.io/crates/cargo-features-manager),
115+
[cargo-unused-features](https://crates.io/crates/cargo-unused-features).
116+
117+
When changing code,
118+
it can be easy to miss that a dependency's feature is no longer used and can be removed.
119+
This can reduced the number of transitive dependencies being built or
120+
reduce the amount of code within a crate being built.
121+
When removing features, extra caution is needed because features
122+
may also be used for desired behavior or performance changes
123+
which may not always be obvious from compiling or testing.
124+
125+
Trade-offs:
126+
- ✅ Faster full build and link times
127+
- ❌ May incorrectly flag features as unused

0 commit comments

Comments
 (0)