[clang-tools-extra] [clang-tidy] Improve redundant-casting check for binary operation (PR #191386)

Gaurav Dhingra via cfe-commits cfe-commits at lists.llvm.org
Thu Apr 16 01:46:47 PDT 2026


================
@@ -168,6 +171,33 @@ void testFunctionalCastWithInitExpr(unsigned a) {
   unsigned c = unsigned{0};
 }
 
+void testBinaryOperatorRedundantCasting() {
+  const auto diff_types_operands1 { static_cast<float>(1.0f + 1) };
----------------
gxyd wrote:

I've just pushed a change for this with making the changes in this PR accessible via an option. Kindly let me know how it looks.

I've made the changes, so that the user can "opt-out" by specifying "IgnoreImplicitCasts" as `true`.

https://github.com/llvm/llvm-project/pull/191386


More information about the cfe-commits mailing list