Skip to content

Add single line if block support for single expression #5939

@Sjael

Description

@Sjael

What did you expect?

if false { continue }
let Some(x) = opt else { return };

What did you get?

if false { 
    continue  
}
let Some(x) = opt else { return };

cargo fmt puts let-else on a single line, and it could do the same to if blocks that have a single expression (i.e. return, break, or continue). That way there can be a consistent style for all guards.

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-feature-requestCategory: a feature request (not decided/implemented)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions