4 ms·
With Rust, we help mitigate this by running code examples in API documentation as tests. That doesn't stop people from opting out, and it doesn't solve every pr
by steveklabnik 7y ago
With Rust, we help mitigate this by running code examples in API documentation as tests. That doesn't stop people from opting out, and it doesn't solve every problem, but it's still quite useful!
- mdtusz 7y agoI'm sure you know because you're Steve Klabnik, but for other readers: you can enforce documentation for public items in a crate by adding `#![deny(missing_docs)]` to the `lib.rs` file. Then it just takes some self-control and gold code reviews to make sure you're writing good documentation rather than just short stubs to silence the error.
- steveklabnik 7y agoYou’d think, but I have certainly committed (in both the colloquial and git sense) a dummy /// TODO comment to silence this warning... oops
- joshmarlow 7y agoI'm going to hijack this thread to recommend Rust Skeptic - https://github.com/budziq/rust-skeptic https://github.com/budziq/rust-skeptic It checks for rust snippets in markdown files and attempts to build them when you run `cargo test`. It helps keep docs and code in sync.