Skip to content

Commit 525ac72

Browse files
committed
Use <=> instead of ==
1 parent 6a9412d commit 525ac72

2 files changed

Lines changed: 6 additions & 4 deletions

File tree

‎cpp2rust/converter/rules/expr_matcher.cpp‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
#include <llvm/ADT/SmallBitVector.h>
1717

1818
#include <cassert>
19+
#include <compare>
1920
#include <optional>
2021
#include <string>
2122
#include <variant>
@@ -51,20 +52,20 @@ bool hasSameArgTypes(clang::ASTContext &ctx, const clang::Expr *use,
5152
struct MacroUsage {
5253
std::string name;
5354

54-
bool operator==(const MacroUsage &) const = default;
55+
auto operator<=>(const MacroUsage &) const = default;
5556
};
5657

5758
struct RewrittenOperatorUsage {
5859
const clang::Decl *decl;
5960
clang::BinaryOperatorKind op;
6061

61-
bool operator==(const RewrittenOperatorUsage &) const = default;
62+
auto operator<=>(const RewrittenOperatorUsage &) const = default;
6263
};
6364

6465
struct AggregateUsage {
6566
RuleKeys::TypeKey type;
6667

67-
bool operator==(const AggregateUsage &) const = default;
68+
auto operator<=>(const AggregateUsage &) const = default;
6869
};
6970

7071
using ResolvedDecl =

‎cpp2rust/converter/rules/rule_keys.h‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
#include <clang/AST/Type.h>
1111
#include <llvm/ADT/Hashing.h>
1212

13+
#include <compare>
1314
#include <optional>
1415
#include <variant>
1516
#include <vector>
@@ -26,7 +27,7 @@ struct Member {
2627
struct Constructor {
2728
const clang::Decl *parent;
2829

29-
bool operator==(const Constructor &) const = default;
30+
auto operator<=>(const Constructor &) const = default;
3031
};
3132

3233
struct Unqualified {

0 commit comments

Comments
 (0)