Open
Description
Problem
Currently, lib.rs
generated by cargo init
(or cargo new
) has no doc comments and doctests.
cargo/src/cargo/ops/cargo_new.rs
Lines 877 to 880 in 5946db3
I think it would be better if the add
function had doc comments and doctests. I think these are useful examples of what happens when we run cargo doc
and cargo test
.
Proposed Solution
Add doc comments and doctests like this:
/// Calculates `left` + `right`.
///
/// # Examples
///
/// ```
/// let result = add(2, 2);
/// assert_eq!(result, 4);
/// ```
pub fn add(left: u64, right: u64) -> u64 {
Notes
No response