Skip to content

rewrite.scala3.removeOptionalBraces - incorrect rewrite for lambda with body in braces #2781

@dos65

Description

@dos65
  • Version: 3.0.5
  • Configuration:
version = "3.0.5"
runner.dialect = scala3
rewrite.scala3.removeOptionalBraces = yes

Steps

Given code like this:

object x:
  val y = List(1).map(v => {
    println(v)
    v + 1
  })

Scalafmt formats code like this:

object x:
  val y = List(1).map(
  v =>
    println(v)
    v + 1)

Expectation

I would like the formatted output to look like this:

object x:
  val y = List(1).map(v => {
    println(v)
    v + 1
  })
// or
object x:
  val y = List(1).map { v =>
    println(v)
    v + 1
  }

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