forked from OSchip/llvm-project
clang-format: Prefer wrapping a lambda's body over the lambda's return type.
Before: aaaaaaaaaaaaaaaaaaaaaa( [](aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa &aaa) -> aaaaaaaaaaaaaaaaaaaaa { return aaaaaaaaaaaaaaaaa; }); After: aaaaaaaaaaaaaaaaaaaaaa( [](aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa &aaa) -> aaaaaaaaaaaaaaaaaaaaa { return aaaaaaaaaaaaaaaaa; }); llvm-svn: 230942
This commit is contained in:
parent
63fbf10c32
commit
e662316994
|
@ -1535,6 +1535,8 @@ unsigned TokenAnnotator::splitPenalty(const AnnotatedLine &Line,
|
|||
return Style.PenaltyReturnTypeOnItsOwnLine;
|
||||
return 200;
|
||||
}
|
||||
if (Right.is(TT_TrailingReturnArrow))
|
||||
return 110;
|
||||
if (Left.is(tok::equal) && Right.is(tok::l_brace))
|
||||
return 150;
|
||||
if (Left.is(TT_CastRParen))
|
||||
|
|
|
@ -9537,6 +9537,12 @@ TEST_F(FormatTest, FormatsLambdas) {
|
|||
" int j) -> int {\n"
|
||||
" return ffffffffffffffffffffffffffffffffffffffffffff(i * j);\n"
|
||||
"};");
|
||||
verifyFormat(
|
||||
"aaaaaaaaaaaaaaaaaaaaaa(\n"
|
||||
" [](aaaaaaaaaaaaaaaaaaaaaaaaaaa &aaa) -> aaaaaaaaaaaaaaaa {\n"
|
||||
" return aaaaaaaaaaaaaaaaa;\n"
|
||||
" });",
|
||||
getLLVMStyleWithColumns(70));
|
||||
|
||||
// Multiple lambdas in the same parentheses change indentation rules.
|
||||
verifyFormat("SomeFunction(\n"
|
||||
|
|
Loading…
Reference in New Issue