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

via cfe-commits cfe-commits at lists.llvm.org
Tue May 27 19:48:55 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"
----------------
rmarker wrote:

No change between before and after. I.e.
```cpp
if (false &&
    []()
    {
      return true;
    }()) {
}
```

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


More information about the cfe-commits mailing list