Skip to content

Commit

Permalink
Rollup merge of rust-lang#117037 - csditchfield:fix_doc_writing_resul…
Browse files Browse the repository at this point in the history
…t_example, r=notriddle

rustdoc book doc example error

closes rust-lang#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>(())
/// ```
```
  • Loading branch information
matthiaskrgr authored Oct 22, 2023
2 parents 4681eb6 + 6596270 commit 77d8a73
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/doc/rustdoc/src/write-documentation/what-to-include.md
Original file line number Diff line number Diff line change
Expand Up @@ -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(())
Expand Down

0 comments on commit 77d8a73

Please sign in to comment.