Cargo doc options to just document my own stuff

How do I get cargo doc to just generate documentation for my own stuff, not every standard crate in use?

  • cargo doc by default does everything public pulled into the project, but not my own private items.

  • cargo doc --workspace does the same thing.

  • cargo doc --package MYPACKAGE --document -private-items includes everything pulled into MYPACKAGE from

Ideally, I'd like it to handle crates from by linking to their public documentation, rather than generating a local copy of it. But that doesn't seem to be an option. For now, I'd be content to have it stop re-documenting standard crates. Thanks.

Use --no-deps option, ie. cargo doc --no-deps. This is the most used subcommand of cargo doc for me.

Sometimes I'll use cargo doc --all --no-deps --document-private-items --all-features to generate additional docs of private items with all features under the workspace.

Ah, that's helpful. It's not clear from the documentation who wins when both -all and --no-deps are set.

That's the probable reason --all is deprecated. I use it for brevity.

$ cargo doc --help
      --workspace               Document all packages in the workspace
      --all                     Alias for --workspace (deprecated)

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.