Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
SOF3 opened this issue Aug 10, 2019 · 2 comments
Open

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

SOF3 opened this issue Aug 10, 2019 · 2 comments
Labels
accepted An amendment that's been accepted and can be applied presentation

Comments

@SOF3
Copy link

SOF3 commented Aug 10, 2019

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 SOF3 changed the title C-QUESTION-MARK: Use shorthand main error type syntax C-QUESTION-MARK: Use simpler main error type syntax Aug 12, 2019
@KodrAus KodrAus added accepted An amendment that's been accepted and can be applied presentation labels Dec 21, 2020
@KodrAus
Copy link
Contributor

KodrAus commented Dec 21, 2020

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

@tshepang
Copy link
Member

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
accepted An amendment that's been accepted and can be applied presentation
Projects
None yet
Development

No branches or pull requests

3 participants