Skip to content

Consider allowing short argument list to stay on same line in single expression body #590

Description

@kyay10

This is difficult to explain, so here's an example:

fun foo() = with(bar) {
  baz()
  baz()
}
// turns into
fun foo() =
    with(bar) {
        baz()
        baz()
    }

It's not atrocious, by any means, but it's annoying since with(bar) is not that large of a cognitive load that one must have it on a separate line.
Btw, this similar example stays the same:

fun foo() = withBar {
  baz()
  baz()
}

I probably wouldn't want something like this to stay:

fun foo() = with(someBarCalculation(fooooo, barrrr, bazzzz, otherArgs, someCalculationEven())) {
  baz()
  baz()
}

but I could see an argument that it should (as long as it's within the max width)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions