Skip to content

[clang-format] BraceWrapping.BeforeLambdaBody can fail to apply when AllowShortLambdasOnASingleLine is enabled #81845

@rmarker

Description

@rmarker

With the following style:

ColumnLimit: 30
BreakBeforeBraces: Allman
AllowShortLambdasOnASingleLine: All

The following code can be misformatted with the lambda body brace not being wrapped.
(This doesn't occur when AllowShortLambdasOnASingleLine is None)

Input:

void f()
{
  std::for_each(
      c.begin(), c.end(),
      [](const auto &Item)
      {
        LongFunctionName(
            Item);
      });
}

Output:

void f()
{
  std::for_each(
      c.begin(), c.end(),
      [](const auto &Item) {
        LongFunctionName(
            Item);
      });
}

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions