api-guidelines icon indicating copy to clipboard operation
api-guidelines copied to clipboard

C-QUESTION-MARK: Use simpler main error type syntax

Open SOF3 opened this issue 6 years ago • 2 comments

According to the rustdoc book:

As of version 1.34.0, one can also omit the fn main(), but you will have to disambiguate the error type:

/// ```
/// use std::io;
/// let mut input = String::new();
/// io::stdin().read_line(&mut input)?;
/// # Ok::<(), io::Error>(())
/// ```

The C-QUESTION-MARK example should adopt this new syntax, since this syntactic sugar encourages doc authors to adopt the ? syntax without a lot of ugly boilerplate.

SOF3 avatar Aug 10 '19 09:08 SOF3

This would be a nice bit of gardening if anybody would like to tidy up the example blocks!

KodrAus avatar Dec 21 '20 23:12 KodrAus

I could not find other example blocks where this change would be applicable @KodrAus

tshepang avatar Dec 22 '20 11:12 tshepang