Skip to content

Commit b5fbe40

Browse files
committed
Clarify that cargo doc --no-deps is cumulative and won’t delete prior docs
1 parent 840b83a commit b5fbe40

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

src/doc/src/commands/cargo-doc.md

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,18 @@ option.</dd>
2626

2727

2828
<dt class="option-term" id="option-cargo-doc---no-deps"><a class="option-anchor" href="#option-cargo-doc---no-deps"></a><code>--no-deps</code></dt>
29-
<dd class="option-desc">Do not build documentation for dependencies.</dd>
30-
29+
<dd class="option-desc">
30+
Do not build documentation for dependencies.
31+
32+
<p><strong>Note:</strong> Cargo keeps docs cumulatively. If you’ve already run
33+
<code>cargo doc</code> (which generated dependency docs), then later run
34+
<code>cargo doc --no-deps</code>, Cargo will skip rebuilding (and won’t delete)
35+
those existing docs. To truly remove old dependency docs, either:
36+
37+
1. Run <code>cargo clean --doc</code> before <code>cargo doc --no-deps</code>, or
38+
2. Manually delete the unwanted folders under <code>target/doc/</code>.
39+
</p>
40+
</dd>
3141

3242
<dt class="option-term" id="option-cargo-doc---document-private-items"><a class="option-anchor" href="#option-cargo-doc---document-private-items"></a><code>--document-private-items</code></dt>
3343
<dd class="option-desc">Include non-public items in the documentation. This will be enabled by default if documenting a binary target.</dd>

0 commit comments

Comments
 (0)