Right now my CI is running cargo doc --no-default-features --features="docs" --no-deps --workspace but I want one and only one child crate also to be included in the documentation. Is this possible at all (nightly or not)?
I want to include the vrl crate in the docs. I'm not opposed to running multiple commands or to any hackery I may have to do, I just want it to work.
Multiple commands are the way. Simply run cargo doc -p vrl --no-deps. Documentation always indexes all crates that have been documented since the last cargo clean — there is no need to specify all wanted packages in the same command.
Hi all, thanks for the replies. Yes, vrl is an upstream dependency of my workspace and not a local lib.
It seems like adding a separate cargo doc -p vrl --no-deps command made the vrl crate documentation available. This fixed my issue, so thanks a lot!
What was tripping me up is that running cargo doc -p vrl --workspace errors out because it tries to find the local lib inside the workspace. AKA --workspace completely changes the behavior of -p. IMO this should be better documented (maybe even a bug?). Either way, thanks!
Myself, not re-reading the docs, I know --workspace as one of the “package selection options” (and --package is one of those too), which changes the package selection from the default set (workspace.default-members) to all of workspace.members.
Before reading this thread, I would have expected --workspace --package=foo to mean one or the other of
“all of the packages in the workspace AND foo”, like specifying --package more than once
“error: specify only one of --workspace or --package, not both”
It’s surprising to me that --workspace is in any way a modifier to --package's behavior, rather than being either independent or conflicting, and I don’t see what scenario that behavior would be useful in.
Yep, you pretty much summed what I was going to reply @kpreid.
I'd expect it to work like check/build does.
cargo doc: documents the main crate (with deps)
cargo doc --no-deps: documents the main crate (without deps)
cargo doc --workspace documents the main crate and workspace crates
I now know that this is wrong (#1 and #3) but that's what I thought --workspace meant and therefore, by that logic, cargo doc --no-deps -p crate and cargo doc --workspace --no-deps -p crate behaving differently is unintuitive.