How do I make lambda signature be not on same line as variable declaration using ClangFormat or ClangTidy

29 Views Asked by At

I am using C++20, LLVM 18.1.1 and I am new to ClangFormat and ClangTidy. I want my formatters to format lambdas like this:

const auto lambda =
[](int a, int b) -> int {
    return a + b;
};
// or like this, though less preferable:
const auto lambda =
    [](int a, int b) -> int {
        return a + b;
    };

But my current ClangFormat makes it like this:

// For my preferance the function signature is too far away
const auto lambda = [](int a, int b) -> int {
    return a + b;
};

I looked through the ClangFormat style options and it had no option for my highly specific opinion on code for some reason :(

0

There are 0 best solutions below