Skip to content

[clang-format] Lambda hanging indent increased by moving to a new line #141575

@rmarker

Description

@rmarker

There is behaviour to minimise the hanging indent with lambdas by moving them to a new line.
However, this can inadvertently increase the amount of hanging indent in particular circumstances.

For example, the following code with -style="{BreakBeforeBraces: Allman, AllowShortLambdasOnASingleLine: false, ContinuationIndentWidth: 8}"

if (
        []()
        {
          return true;
        }())
{
}

fun(
        []()
        {
          return 17;
        });

Expected:

if ([]()
    {
      return true;
    }())
{
}

fun([]()
    {
      return 17;
    });

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