How to make infra-doc link to crate without adding crate to dependencies

381 Views Asked by At

Rust allows to make links in documentation in the form

/// link to structure [Foo](foo::Foo) in crate foo

To make this work the linked crate should be in dependencies section in Cargo.toml:

[dependencies]
foo = "1.0"

What to do if I want to make such link, but do not want to make my crate dependent on foo? For tests and examples this is achieved by dev-dependencies option in Cargo.toml:

[dev-dependencies]
foo = "1.0"

But this doesn't work for building documentation with cargo doc.

0

There are 0 best solutions below