From 8c7aa373abe2ac190c793ecee131c8d5ffcd6ec0 Mon Sep 17 00:00:00 2001 From: Nick Gerleman Date: Wed, 25 Feb 2026 08:05:55 -0800 Subject: [PATCH] Remove redundant operator!= definitions in react-native-github Summary: C++20 automatically generates `operator!=` from `operator==`, making explicit `operator!=` definitions redundant. This removes all such redundant definitions across the React Native C++ codebase, including: - Simple negation patterns (`return !(*this == rhs)`) - Explicit `= default` declarations that duplicate the compiler-generated behavior - Both member and free-function forms Files in jsi/ were excluded as they are mirrored to a project that may not support C++20. Changelog: [Internal] Reviewed By: sammy-SC Differential Revision: D94370249 --- yoga/YGValue.h | 4 ---- yoga/enums/YogaEnums.h | 1 - yoga/node/LayoutResults.h | 3 --- yoga/numeric/FloatOptional.h | 9 --------- yoga/style/Style.h | 4 ---- 5 files changed, 21 deletions(-) diff --git a/yoga/YGValue.h b/yoga/YGValue.h index b7c4ba25f7..138135229b 100644 --- a/yoga/YGValue.h +++ b/yoga/YGValue.h @@ -77,10 +77,6 @@ inline bool operator==(const YGValue& lhs, const YGValue& rhs) { } } -inline bool operator!=(const YGValue& lhs, const YGValue& rhs) { - return !(lhs == rhs); -} - inline YGValue operator-(const YGValue& value) { return {-value.value, value.unit}; } diff --git a/yoga/enums/YogaEnums.h b/yoga/enums/YogaEnums.h index de446621d5..521d9f7a32 100644 --- a/yoga/enums/YogaEnums.h +++ b/yoga/enums/YogaEnums.h @@ -67,7 +67,6 @@ auto ordinals() { } bool operator==(const Iterator& other) const = default; - bool operator!=(const Iterator& other) const = default; }; struct Range { diff --git a/yoga/node/LayoutResults.h b/yoga/node/LayoutResults.h index 6776a42340..833dc927b2 100644 --- a/yoga/node/LayoutResults.h +++ b/yoga/node/LayoutResults.h @@ -111,9 +111,6 @@ struct LayoutResults { } bool operator==(LayoutResults layout) const; - bool operator!=(LayoutResults layout) const { - return !(*this == layout); - } private: Direction direction_ : bitCount() = Direction::Inherit; diff --git a/yoga/numeric/FloatOptional.h b/yoga/numeric/FloatOptional.h index 4f2e5db92f..c255277ae3 100644 --- a/yoga/numeric/FloatOptional.h +++ b/yoga/numeric/FloatOptional.h @@ -44,23 +44,14 @@ constexpr bool operator==(FloatOptional lhs, FloatOptional rhs) { return lhs.unwrap() == rhs.unwrap() || (lhs.isUndefined() && rhs.isUndefined()); } -constexpr bool operator!=(FloatOptional lhs, FloatOptional rhs) { - return !(lhs == rhs); -} constexpr bool operator==(FloatOptional lhs, float rhs) { return lhs == FloatOptional{rhs}; } -constexpr bool operator!=(FloatOptional lhs, float rhs) { - return !(lhs == rhs); -} constexpr bool operator==(float lhs, FloatOptional rhs) { return rhs == lhs; } -constexpr bool operator!=(float lhs, FloatOptional rhs) { - return !(lhs == rhs); -} constexpr FloatOptional operator+(FloatOptional lhs, FloatOptional rhs) { return FloatOptional{lhs.unwrap() + rhs.unwrap()}; diff --git a/yoga/style/Style.h b/yoga/style/Style.h index 566b6934e6..bea3d37992 100644 --- a/yoga/style/Style.h +++ b/yoga/style/Style.h @@ -548,10 +548,6 @@ class YG_EXPORT Style { numbersEqual(aspectRatio_, pool_, other.aspectRatio_, other.pool_); } - bool operator!=(const Style& other) const { - return !(*this == other); - } - private: using Dimensions = std::array()>; using Edges = std::array()>;