Issue 143877
Summary clang-format set short lambda max length?
Labels clang-format
Assignees
Reporter Vladislav-Bartalevich
    Is it possible to set a maximum length for short lambdas?

In my project, I want to achieve two things:

* Short lambdas should stay on a single line (so I have AllowShortLambdasOnASingleLine: All)
* Allman-style line breaks before braces for long lambdas (so I have BreakBeforeBraces: Allman)

However, it seems that clang-format uses a default maximum line length of 90 characters for short lambdas. When the line length reaches or exceeds 90, clang-format always introduces a line break.

>From a code formatting perspective, I want this:
```
auto SomeLongOneLiner = [](int SomeLongPieceOfCodeHere) { return SomeLongPieceOfCodeHere != 2; };  // 114 characters
```
To remain on a single line as shown above. But when I run the formatter, it transforms the code into:
```
auto SomeLongOneLiner = [](int SomeLongPieceOfCodeHere)
{ return SomeLongPieceOfCodeHere != 2; };
```
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to