[PATCH] D102706: [clang-format] Add new LambdaBodyIndentation option

Björn Schäpers via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu May 20 02:23:30 PDT 2021


HazardyKnusperkeks added a comment.

In D102706#2766871 <https://reviews.llvm.org/D102706#2766871>, @vlovich wrote:

> In D102706#2766680 <https://reviews.llvm.org/D102706#2766680>, @HazardyKnusperkeks wrote:
>
>> Maybe a bit more test cases with smaller lambdas? Or without the outer parenthesis?
>
> I'm not sure I understand this comment. Which test case are you referring to by "or without the outer parenthesis"?



  verifyFormat("test() {\n"
                 "  ([]() -> {\n"
                 "    int b = 32;\n"
                 "    return 3;\n"
                 "  }).foo();\n"
                 "}",
                 Style);

There you have parenthesis around the lambda, how about without?
Maybe just something like

  std::sort(v.begin(), v.end(), [](const auto& lhs, const auto& rhs) { return lhs.Foo < rhs.Foo; });


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D102706/new/

https://reviews.llvm.org/D102706



More information about the cfe-commits mailing list