diff --git a/common/types/enum_type.cc b/common/types/enum_type.cc index bb567d542..89d095e73 100644 --- a/common/types/enum_type.cc +++ b/common/types/enum_type.cc @@ -81,10 +81,6 @@ class BasicEnumType final : public EnumTypeInterface { private: friend class BasicEnumTypeValueIterator; - bool Equals(const EnumTypeInterface&) const override { return true; } - - void HashValue(absl::HashState) const override {} - absl::StatusOr> FindIdByName( absl::string_view name) const override { if (auto it = values_by_name_.find(name); it != values_by_name_.end()) { diff --git a/common/types/enum_type.h b/common/types/enum_type.h index 983462839..3b8735ee1 100644 --- a/common/types/enum_type.h +++ b/common/types/enum_type.h @@ -29,7 +29,6 @@ #include "absl/base/attributes.h" #include "absl/base/nullability.h" -#include "absl/hash/hash.h" #include "absl/log/absl_check.h" #include "absl/meta/type_traits.h" #include "absl/status/statusor.h" @@ -160,16 +159,6 @@ class EnumTypeInterface : public TypeInterface, private: friend class EnumType; friend class EnumTypeView; - friend bool operator==(const EnumType& lhs, const EnumType& rhs); - template - friend H AbslHashValue(H state, const EnumType& type); - friend bool operator==(EnumTypeView lhs, EnumTypeView rhs); - template - friend H AbslHashValue(H state, EnumTypeView type); - - virtual bool Equals(const EnumTypeInterface& other) const = 0; - - virtual void HashValue(absl::HashState state) const = 0; virtual absl::StatusOr> FindIdByName( absl::string_view name) const ABSL_ATTRIBUTE_LIFETIME_BOUND = 0; @@ -248,14 +237,12 @@ class EnumType { } friend bool operator==(const EnumType& lhs, const EnumType& rhs) { - return lhs.name() == rhs.name() && lhs.interface_->Equals(*rhs.interface_); + return lhs.name() == rhs.name(); } template friend H AbslHashValue(H state, const EnumType& type) { - state = H::combine(std::move(state), type.kind(), type.name()); - type.interface_->HashValue(absl::HashState::Create(&state)); - return std::move(state); + return H::combine(std::move(state), type.kind(), type.name()); } private: @@ -453,14 +440,12 @@ class EnumTypeView { } friend bool operator==(EnumTypeView lhs, EnumTypeView rhs) { - return lhs.name() == rhs.name() && lhs.interface_->Equals(*rhs.interface_); + return lhs.name() == rhs.name(); } template friend H AbslHashValue(H state, EnumTypeView type) { - state = H::combine(std::move(state), type.kind(), type.name()); - type.interface_->HashValue(absl::HashState::Create(&state)); - return std::move(state); + return H::combine(std::move(state), type.kind(), type.name()); } private: diff --git a/common/types/enum_type_test.cc b/common/types/enum_type_test.cc index f364e02f5..20150cb4a 100644 --- a/common/types/enum_type_test.cc +++ b/common/types/enum_type_test.cc @@ -74,10 +74,6 @@ class CustomEnumTypeInterface final private: friend class CustomEnumTypeValueIterator; - bool Equals(const EnumTypeInterface&) const override { return true; } - - void HashValue(absl::HashState) const override {} - absl::StatusOr> FindIdByName( absl::string_view name) const override { if (name == "FOO") {