diff --git a/src/core-taggeds-optional/Optional/Optional.T.EqualityComparer/Optional.T.EqualityComparer.Equality.cs b/src/core-taggeds-optional/Optional/Optional.T.EqualityComparer/Optional.T.EqualityComparer.Equality.cs index 09131dcc..bc66e30a 100644 --- a/src/core-taggeds-optional/Optional/Optional.T.EqualityComparer/Optional.T.EqualityComparer.Equality.cs +++ b/src/core-taggeds-optional/Optional/Optional.T.EqualityComparer/Optional.T.EqualityComparer.Equality.cs @@ -1,6 +1,4 @@ -using System.Runtime.CompilerServices; - -namespace System; +namespace System; partial struct Optional { @@ -22,19 +20,14 @@ public bool Equals(Optional x, Optional y) } public int GetHashCode(Optional obj) - => - obj.hasValue ? PresentHashCode(obj.value) : AbsentHashCode(); - - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private int PresentHashCode(T value) - => - value is not null - ? HashCode.Combine(true, comparer.GetHashCode(value)) - : HashCode.Combine(true); + { + if (obj.hasValue) + { + return HashCode.Combine( + obj.value is null ? default : comparer.GetHashCode(obj.value)); + } - [MethodImpl(MethodImplOptions.AggressiveInlining)] - private static int AbsentHashCode() - => - HashCode.Combine(false); + return default; + } } }