Skip to content

Rule idea: allow single line guard ... else statements if there is only one line in the else #2296

@devkonlinenet

Description

@devkonlinenet

In case like
guard let item = viewModel.item else { return }
I would like to keep the { return } on the same line, rather than
guard let item = viewModel.item else {
return
}
This could be limited to else statements that are just one line long (which is very common).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions