0

Modernize equality operators

This CL is pure clean-up and contains no functionality changes.
Depending on the files covered in the CL (since the CL was generated
using git cl split), it does a subset of the following:
- Remove unneeded operator!= declarations/definitions since C++20 can
  automatically derive those from operator==.
- Default operator== where this is equivalent to the current behavior.
- Default operator<=> where this is equivalent to the current
  behavior.

This CL was uploaded by git cl split.

R=alexmt@chromium.org

Bug: 40256175
Change-Id: I61ffd98e5ce2e07b98353b99a562a019e4b562db
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6516392
Auto-Submit: Jan Keitel <jkeitel@google.com>
Reviewed-by: Alex Turner <alexmt@chromium.org>
Commit-Queue: Alex Turner <alexmt@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1456334}
This commit is contained in:
Jan Keitel
2025-05-06 08:00:56 -07:00
committed by Chromium LUCI CQ
parent 403646b933
commit e6c1fc76ce
4 changed files with 1 additions and 13 deletions
components/subresource_filter

@ -342,10 +342,6 @@ bool Configuration::operator==(const Configuration& rhs) const {
return tie(*this) == tie(rhs);
}
bool Configuration::operator!=(const Configuration& rhs) const {
return !(*this == rhs);
}
std::unique_ptr<base::trace_event::TracedValue>
Configuration::ActivationConditions::ToTracedValue() const {
auto value = std::make_unique<base::trace_event::TracedValue>();

@ -103,7 +103,6 @@ struct Configuration {
Configuration& operator=(Configuration&&);
bool operator==(const Configuration& rhs) const;
bool operator!=(const Configuration& rhs) const;
void AddToValue(base::trace_event::TracedValue*) const;
std::unique_ptr<base::trace_event::TracedValue> ToTracedValue() const;

@ -149,11 +149,6 @@ CssRule::~CssRule() = default;
CssRule& CssRule::operator=(const CssRule&) = default;
bool CssRule::operator==(const CssRule& other) const {
return is_allowlist == other.is_allowlist && domains == other.domains &&
css_selector == other.css_selector;
}
url_pattern_index::proto::CssRule CssRule::ToProtobuf() const {
url_pattern_index::proto::CssRule result;

@ -52,7 +52,6 @@ struct UrlRule {
UrlRule& operator=(const UrlRule&);
bool operator==(const UrlRule& other) const;
bool operator!=(const UrlRule& other) const { return !operator==(other); }
// Returns a protobuf representation of the rule.
url_pattern_index::proto::UrlRule ToProtobuf() const;
@ -102,8 +101,7 @@ struct CssRule {
~CssRule();
CssRule& operator=(const CssRule&);
bool operator==(const CssRule& other) const;
bool operator!=(const CssRule& other) const { return !operator==(other); }
friend bool operator==(const CssRule&, const CssRule&) = default;
// Returns a protobuf representation of the rule.
url_pattern_index::proto::CssRule ToProtobuf() const;