Skip to content

Commit 417a5cd

Browse files
committed
removed unneeded Token equals comparisson
1 parent 4d0deb2 commit 417a5cd

File tree

2 files changed

+2
-35
lines changed

2 files changed

+2
-35
lines changed

Src/SmtpServer/Protocol/SmtpParser.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -947,7 +947,7 @@ public bool TryMakeEnd(ref TokenReader reader)
947947
{
948948
reader.Skip(TokenKind.Space);
949949

950-
return reader.Take() == default;
950+
return reader.Take().Kind == TokenKind.None;
951951
}
952952

953953
/// <summary>
@@ -1802,7 +1802,7 @@ public bool TryMakeMailParameters(ref TokenReader reader, out IReadOnlyDictionar
18021802
{
18031803
Dictionary<string, string> dictionary = null;
18041804

1805-
while (reader.Peek() != default)
1805+
while (reader.Peek().Kind != TokenKind.None)
18061806
{
18071807
if (reader.TryMake(TryMakeEsmtpParameter, out ReadOnlySequence<byte> keyword, out ReadOnlySequence<byte> value) == false)
18081808
{

Src/SmtpServer/Text/Token.cs

-33
Original file line numberDiff line numberDiff line change
@@ -88,39 +88,6 @@ static bool IsBetween(byte value, byte low, byte high)
8888
return value >= low && value <= high;
8989
}
9090

91-
/// <summary>
92-
/// Indicates whether this instance and a specified object are equal.
93-
/// </summary>
94-
/// <param name="other">Another object to compare to. </param>
95-
/// <returns>true if <paramref name="other"/> and this instance are the same type and represent the same value; otherwise, false. </returns>
96-
public bool Equals(Token other)
97-
{
98-
// TODO: need a faster comparisson implementation
99-
return Kind == other.Kind && Text.ToString().Equals(other.Text.ToString(), StringComparison.OrdinalIgnoreCase);
100-
}
101-
102-
/// <summary>
103-
/// Returns a value indicating the equality of the two objects.
104-
/// </summary>
105-
/// <param name="left">The left hand side of the comparisson.</param>
106-
/// <param name="right">The right hand side of the comparisson.</param>
107-
/// <returns>true if the left and right side are equal, false if not.</returns>
108-
public static bool operator ==(Token left, Token right)
109-
{
110-
return left.Equals(right);
111-
}
112-
113-
/// <summary>
114-
/// Returns a value indicating the inequality of the two objects.
115-
/// </summary>
116-
/// <param name="left">The left hand side of the comparisson.</param>
117-
/// <param name="right">The right hand side of the comparisson.</param>
118-
/// <returns>false if the left and right side are equal, true if not.</returns>
119-
public static bool operator !=(Token left, Token right)
120-
{
121-
return !left.Equals(right);
122-
}
123-
12491
/// <summary>
12592
/// Returns the string representation of the token.
12693
/// </summary>

0 commit comments

Comments
 (0)