diff options
| author | Matthias Krüger <matthias.krueger@famsik.de> | 2023-10-22 09:15:43 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-10-22 09:15:43 +0200 |
| commit | 77d8a73fa2afb6991d17b797daba7d4e46e91ba5 (patch) | |
| tree | b44ef6981a6499c8180311f8a7f76a36f86fb65b /src | |
| parent | 4681eb6c94188dc15ec02ea3bcb1aede89754763 (diff) | |
| parent | 65962708f801afefd0d04a77ad171788df0918e6 (diff) | |
| download | rust-77d8a73fa2afb6991d17b797daba7d4e46e91ba5.tar.gz rust-77d8a73fa2afb6991d17b797daba7d4e46e91ba5.zip | |
Rollup merge of #117037 - csditchfield:fix_doc_writing_result_example, r=notriddle
rustdoc book doc example error
closes #117036
This is the minimal change required to make the second what-to-include.md example valid.
Another more modern solution could be considered:
```
/// Example
/// ```rust
/// let fortytwo = "42".parse::<u32>()?;
/// println!("{} + 10 = {}", fortytwo, fortytwo+10);
/// # Ok::<(), <u32 as std::str::FromStr>::Err>(())
/// ```
```
Diffstat (limited to 'src')
| -rw-r--r-- | src/doc/rustdoc/src/write-documentation/what-to-include.md | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/doc/rustdoc/src/write-documentation/what-to-include.md b/src/doc/rustdoc/src/write-documentation/what-to-include.md index 4bcae4d222c..75d3b7dae61 100644 --- a/src/doc/rustdoc/src/write-documentation/what-to-include.md +++ b/src/doc/rustdoc/src/write-documentation/what-to-include.md @@ -73,7 +73,7 @@ and your test suite, this example needs some additional code: ``````text /// Example /// ```rust -/// # main() -> Result<(), std::num::ParseIntError> { +/// # fn main() -> Result<(), std::num::ParseIntError> { /// let fortytwo = "42".parse::<u32>()?; /// println!("{} + 10 = {}", fortytwo, fortytwo+10); /// # Ok(()) |
