[clang-tools-extra] [clang-tidy] Add readability-redundant-lambda-parentheses check (PR #190438)
Daniil Dudkin via cfe-commits
cfe-commits at lists.llvm.org
Wed Apr 8 15:11:57 PDT 2026
================
@@ -86,6 +86,22 @@ int main() {
auto s = []() noexcept [[]] {};
// CHECK-MESSAGES-CXX23: :[[@LINE-1]]:14: warning: redundant empty parameter list in lambda expression [readability-redundant-lambda-parentheses]
// CHECK-FIXES-CXX23: auto s = [] noexcept {{\[\[}}{{\]\]}} {};
+
+ auto t = []( /* comment */ ) { return 42; };
+ // CHECK-MESSAGES: :[[@LINE-1]]:14: warning: redundant empty parameter list in lambda expression [readability-redundant-lambda-parentheses]
+ // CHECK-FIXES: auto t = [] { return 42; };
+
+ auto u = []() /* comment */ { return 42; };
+ // CHECK-MESSAGES: :[[@LINE-1]]:14: warning: redundant empty parameter list in lambda expression [readability-redundant-lambda-parentheses]
+ // CHECK-FIXES: auto u = [] /* comment */ { return 42; };
+
+ auto w = [](/* comment */) { return 42; };
+ // CHECK-MESSAGES: :[[@LINE-1]]:14: warning: redundant empty parameter list in lambda expression [readability-redundant-lambda-parentheses]
+ // CHECK-FIXES: auto w = [] { return 42; };
----------------
unterumarmung wrote:
Also with macros for LParen and RParen separately and combined
https://github.com/llvm/llvm-project/pull/190438
More information about the cfe-commits
mailing list