I've just started playing with Rust and was trying to generate docs for the code I've written. When I issued cargo doc
, I saw something a little weird.
21:53 $ cargo doc
Compiling regex-syntax v0.2.2
Compiling libc v0.2.2
Compiling memchr v0.1.7
Compiling aho-corasick v0.3.4
Compiling regex v0.1.41
Compiling my_project v0.0.1 (path/to/my_project)
When I opened my_project/target/doc/my_project/index.html
, I noticed that all of the dependencies were included in my docs:
I'd like these dependencies' documentations to be hidden from the user so my documentation only shows how to use my code.
How can I do this?
[root]
name = "my_project"
version = "0.0.1"
dependencies = [
"regex 0.1.41 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "aho-corasick"
version = "0.3.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"memchr 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "libc"
version = "0.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "memchr"
version = "0.1.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"libc 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "regex"
version = "0.1.41"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"aho-corasick 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)",
"memchr 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)",
"regex-syntax 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "regex-syntax"
version = "0.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
I found the answer: cargo doc --no-deps
.