[Clang-Format][Feature Request] Add/Remove parentheses of lambda expression/requires expression if there is no function paremeter.
Open
clang-format
enhancement
- Dominant language
- LLVM
- Stars
- 40.5k
- Forks
- 18.7k
- PR merge metrics
- PR metrics pending
Description
```cpp
// after adding parenthses
[]() { /* body */ };
requires () { /* body */ };
// after removing parentheses
[] { /* body */ };
requires { /* body */ };
[] () [[attr]] { /* body */ }; // should not be affected
// ^ they are not equivalent v
[] [[attr]] { /* body */ };
// ^ they are equivalent v
[] [[attr]] () { /* body */ };
// can remove parentheses only in C++23 (or later) mode
[] /* contains something other than `()` and template parameter list */ { /* body */ };
```
See https://en.cppreference.com/w/cpp/language/lambda.html for detailed syntax.
Contributor guide
Assessment
This issue has not been assessed yet.