1
0
mirror of https://github.com/ppy/osu.git synced 2024-09-21 18:07:23 +08:00

Don't use Equals(object) on T?.

This commit is contained in:
Huo Yaoyuan 2019-12-03 20:07:22 +08:00
parent 8a6b2e681a
commit a42f9447e6
3 changed files with 4 additions and 3 deletions

View File

@ -1,5 +1,6 @@
M:System.Object.Equals(System.Object,System.Object)~System.Boolean;Don't use object.Equals. Use IEquatable<T> or EqualityComparer<T>.Default instead. M:System.Object.Equals(System.Object,System.Object)~System.Boolean;Don't use object.Equals. Use IEquatable<T> or EqualityComparer<T>.Default instead.
M:System.Object.Equals(System.Object)~System.Boolean;Don't use object.Equals. Use IEquatable<T> or EqualityComparer<T>.Default instead. M:System.Object.Equals(System.Object)~System.Boolean;Don't use object.Equals. Use IEquatable<T> or EqualityComparer<T>.Default instead.
M:System.ValueType.Equals(System.Object)~System.Boolean;Don't use object.Equals(Fallbacks to ValueType). Use IEquatable<T> or EqualityComparer<T>.Default instead. M:System.ValueType.Equals(System.Object)~System.Boolean;Don't use object.Equals(Fallbacks to ValueType). Use IEquatable<T> or EqualityComparer<T>.Default instead.
M:System.Nullable`1.Equals(System.Object)~System.Boolean;Use == instead.
T:System.IComparable;Don't use non-generic IComparable. Use generic version instead. T:System.IComparable;Don't use non-generic IComparable. Use generic version instead.
M:osu.Framework.Graphics.Sprites.SpriteText.#ctor;Use OsuSpriteText. M:osu.Framework.Graphics.Sprites.SpriteText.#ctor;Use OsuSpriteText.

View File

@ -280,7 +280,7 @@ namespace osu.Game.Rulesets.Objects
if (other.ControlPoints == null && ControlPoints != null) if (other.ControlPoints == null && ControlPoints != null)
return false; return false;
return ControlPoints.SequenceEqual(other.ControlPoints) && ExpectedDistance.Equals(other.ExpectedDistance) && Type == other.Type; return ControlPoints.SequenceEqual(other.ControlPoints) && ExpectedDistance == other.ExpectedDistance && Type == other.Type;
} }
} }
} }

View File

@ -79,8 +79,8 @@ namespace osu.Game.Screens.Select
public bool IsUpperInclusive; public bool IsUpperInclusive;
public bool Equals(OptionalRange<T> other) public bool Equals(OptionalRange<T> other)
=> Min.Equals(other.Min) => EqualityComparer<T?>.Default.Equals(Min, other.Min)
&& Max.Equals(other.Max) && EqualityComparer<T?>.Default.Equals(Max, other.Max)
&& IsLowerInclusive.Equals(other.IsLowerInclusive) && IsLowerInclusive.Equals(other.IsLowerInclusive)
&& IsUpperInclusive.Equals(other.IsUpperInclusive); && IsUpperInclusive.Equals(other.IsUpperInclusive);
} }