[clang] [clang-format] Stop moving lambda to new line only to indent it more. (PR #141576)

Björn Schäpers via cfe-commits cfe-commits at lists.llvm.org
Tue May 27 11:36:23 PDT 2025


================
@@ -23814,6 +23814,20 @@ TEST_F(FormatTest, FormatsLambdas) {
                "}",
                LLVMWithBeforeLambdaBody);
 
+  // Make sure we don't put the lambda on a new line when it would be indented
+  // more than where it would be otherwise.
+  verifyFormat("if ([]()\n"
----------------
HazardyKnusperkeks wrote:

How does
```
if (false && []() { return true; }()) {}
```
look before and after your patch?

https://github.com/llvm/llvm-project/pull/141576


More information about the cfe-commits mailing list