In order to ensure that all public artifacts of my crate are documented (if minimally to start with), I specified #![deny(missing_docs)]
in my lib.rs
I found the hidden nugget in the book's Publishing a Crate to Crates.io section.
Regular documentation comments (starting with ///
) document the next item, however a crate is nobody's next.
The solution is to switch to using another kind of comment, this time starting with //!
, which documents the enclosing item.
And suddenly it works:
#![deny(missing_docs)]
//! Hello world example for Rust.
fn main() {
println!("Hello world!");
}