根据doc.rust-lang.org
使用指定的自定义标志构建 [s] 包的文档
构建一个包的文档
两者有什么区别?据我了解cargo rustdoc
,就像cargo doc
,但它允许更多的 lints - 例如:
#![deny(rustdoc::broken_intra_doc_links)]
这个对吗?奇怪的是,cargo rustdoc
在某些情况下也会失败cargo doc
。例如
some/folder on some-branch [$!] via v1.60.0-nightly
❯ cargo doc
Finished dev [unoptimized + debuginfo] target(s) in 0.53s
some/folder on some-branch [$!] via v1.60.0-nightly
❯ cargo rustdoc
error: manifest path `some/folder/Cargo.toml` is a virtual manifest, but this command requires running against an actual package in this workspace
此外,cargo doc
不支持添加-D
选项,而支持cargo rustdoc
。
❯ cargo doc -- -D rustdoc::broken_intra_doc_links
error: Found argument '-D' which wasn't expected, or isn't valid in this context
USAGE:
cargo doc [OPTIONS]
For more information try --help