Skip to content

Commit

Permalink
expression bodies
Browse files Browse the repository at this point in the history
  • Loading branch information
ax0l0tl committed Apr 12, 2024
1 parent e888967 commit 2d285d8
Showing 1 changed file with 4 additions and 16 deletions.
20 changes: 4 additions & 16 deletions Source/FunicularSwitch/Option.cs
Original file line number Diff line number Diff line change
Expand Up @@ -112,15 +112,9 @@ public async Task<TResult> Match<TResult>(Func<T, Task<TResult>> some, TResult n

public override string ToString() => Match(v => v?.ToString() ?? "", () => $"None {typeof(T).BeautifulName()}");

public bool Equals(Option<T> other)
{
return _isSome == other._isSome && EqualityComparer<T>.Default.Equals(_value, other._value);
}
public bool Equals(Option<T> other) => _isSome == other._isSome && EqualityComparer<T>.Default.Equals(_value, other._value);

public override bool Equals(object? obj)
{
return obj is Option<T> other && Equals(other);
}
public override bool Equals(object? obj) => obj is Option<T> other && Equals(other);

public override int GetHashCode()
{
Expand All @@ -130,15 +124,9 @@ public override int GetHashCode()
}
}

public static bool operator ==(Option<T> left, Option<T> right)
{
return left.Equals(right);
}
public static bool operator ==(Option<T> left, Option<T> right) => left.Equals(right);

public static bool operator !=(Option<T> left, Option<T> right)
{
return !left.Equals(right);
}
public static bool operator !=(Option<T> left, Option<T> right) => !left.Equals(right);
}

public static class OptionExtension
Expand Down

0 comments on commit 2d285d8

Please sign in to comment.