Skip to content

? patterns #2012

Open
Open
@devyn

Description

@devyn

I've written a lot of code like this for libraries that use Iterators where the Item is a Result:

for line_r in stdin.lock().lines() {
    let line = line_r?;

    // do something with line
}

I think it would be awesome if we could just relocate the ? to the pattern, like this:

for line? in stdin.lock().lines() {
    // do something with line
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    T-langRelevant to the language team, which will review and decide on the RFC.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions