Is there a way to include something into documentation scope without including it into the code scope? My Rustdoc links to a Trait that's not in the code scope. If I add use std::ops::Add
at the top, I get unused import
warning from cargo build
. If I don't add it, I get unresolved link
warning from cargo doc
.
In theory, cargo build
should not warn me because rustdoc is in the same scope as the main code, but it does.
/// [Add]
pub fn foo() {}
You can fully qualify the link.
Note that the syntax you've been using is shorthand for
and the thing in parentheses at the end can be any valid qualified name, including fully qualified ones starting at
std
or the name of some other crate.