Skip to content

Commit b4c7aca

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

File tree

2 files changed

+21
-2
lines changed

2 files changed

+21
-2
lines changed

src/doc/man/cargo-doc.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,15 @@ option.
3131

3232
{{#option "`--no-deps`" }}
3333
Do not build documentation for dependencies.
34+
35+
**Note:** Documentation is _cumulative_. If you’ve already run
36+
`cargo doc` (including dependency docs), and later run
37+
`cargo doc --no-deps`, Cargo will skip deleting or rebuilding those
38+
old dependency docs. To remove them, you can either:
39+
40+
1. Run `cargo clean --doc` before `cargo doc --no-deps`, or
41+
2. Manually delete the unwanted folders under `target/doc/`.
42+
3443
{{/option}}
3544

3645
{{#option "`--document-private-items`" }}

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)