Why this matters
Rustdoc renders examples and validates them as doctests.
Document public items with /// and modules/crates with //!; include minimal runnable examples that pass doctests where applicable.
Rustdoc renders examples and validates them as doctests.
Side-by-side examples engineers can pattern-match during review.
pub fn sum(a: i32, b: i32) -> i32 { a + b }/// Add two integers.
///
/// # Examples
///
/// assert_eq!(sum(2, 3), 5);
///
pub fn sum(a: i32, b: i32) -> i32 { a + b }//! Utilities for math operations.// Utilities for math operations.From the same buckets as this rule.