Equality warning fixes
MODIFY
WalletWasabi/Models/ErrorDescriptor.cs
WalletWasabi/Models/ErrorDescriptor.cs
@@ -13,9 +13,18 @@ namespace WalletWasabi.Models
public ErrorSeverity Severity { get; }
public string Message { get; }
- public bool Equals(ErrorDescriptor other)
- {
- return (Severity == other.Severity && Message == other.Message);
- }
+ #region Equality
+
+ public override bool Equals(object? obj) => obj is { } && Equals((ErrorDescriptor)obj);
+
+ public bool Equals(ErrorDescriptor other) => this == other;
+
+ public override int GetHashCode() => (Severity, Message).GetHashCode();
+
+ public static bool operator ==(ErrorDescriptor? x, ErrorDescriptor? y) => (x?.Severity, x?.Message) == (y?.Severity, y?.Message);
+
+ public static bool operator !=(ErrorDescriptor? x, ErrorDescriptor? y) => !(x == y);
+
+ #endregion Equality
}
}

MODIFY
WalletWasabi/Models/Height.cs
WalletWasabi/Models/Height.cs
@@ -321,7 +321,7 @@ namespace WalletWasabi.Models
public static bool operator <=(Height x, int y) => x.Value <= y;
/// <inheritdoc/>
- public override bool Equals(object obj) => obj is Height height && this == height;
+ public override bool Equals(object? obj) => obj is Height height && this == height;
/// <inheritdoc/>
public bool Equals(Height other) => this == other;

Equality warning fixes