How do I change Cargo.toml so that I don't have to type --no-deps every time I build the docs?


By default, cargo doc generates documentation not only for the project I’m working on, but also its entire dependency graph. This does not seem like a sensible default behaviour (given just how many things can be in such a graph); if I want the documentation for the dependencies (which I do), I know where to find it.

How do I configure things so that --no-deps is the default behaviour of cargo doc and I have to manually override it if I do want to build the documentation for the dependencies?


I think you can create an alias in Cargo.

Here is an example from tests:

I fail to find documentation for this feature :frowning: Does anybody know where it is documented?

EDIT: documented here


While I think having it configurable makes sense, I think the current default is sensible. I use it very often to read the docs of the exact libraries I depend on during development.

Hiding it behind a flag would make such a crucial feature something you need to inform everyone about.