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

Vitali Lovich via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu May 20 14:39:04 PDT 2021


vlovich added a comment.

> 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; });
>
>   

Ah. Ok. What I had done was run all the tests with this flag & note the ones where the formatting changed & copied those. The one without parenthesis didn't do anything interesting which is why I omitted it originally. I'll add it back + your sort example too. Thanks!


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