8000 Unexpected newline before opening brace for method calls with trailing closures · Issue #266 · google/swift · GitHub
[go: up one dir, main page]

Skip to content
This repository was archived by the owner on Jan 10, 2023. It is now read-only.
This repository was archived by the owner on Jan 10, 2023. It is now read-only.

Unexpected newline before opening brace for method calls with trailing closures #266

Open

Description

@andriichernenko

I tried formatting the project I'm working on with swift-format (using default configuration with 4-space indentation) and noticed that the following code:

return Presentation(editProduct, style: .modalOrFlip)
    .onValue {
        $0.map { self.libraryStore.edit(.add(.product($0))) }
    }
    .onPresent {
        isEditingLibrary.value = true
}

is formatted as

return Presentation(editProduct, style: .modalOrFlip)
    .onValue
{
    $0.map { self.libraryStore.edit(.add(.product($0))) }
}
    .onPresent
{
    isEditingLibrary.value = true
}

As I understand, this is done according to the rule 5 in the Line Wrapping section of the Swift Style Guide. In my opinion, however, newlines before opening braces are unnecessary in this case and should not be added.

Activity

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      0