Skip to content

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

@SOF3

Description

@SOF3

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.

Activity

changed the title [-]C-QUESTION-MARK: Use shorthand main error type syntax[/-] [+]C-QUESTION-MARK: Use simpler main error type syntax[/+] on Aug 12, 2019
KodrAus

KodrAus commented on Dec 21, 2020

@KodrAus
Contributor

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

tshepang

tshepang commented on Dec 22, 2020

@tshepang
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

Metadata

Metadata

Assignees

No one assigned

    Labels

    acceptedAn amendment that's been accepted and can be appliedpresentation

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @tshepang@KodrAus@SOF3

        Issue actions

          C-QUESTION-MARK: Use simpler main error type syntax · Issue #201 · rust-lang/api-guidelines