Skip to content

Commit

Permalink
Remove unnecessary taking ofthis as argument
Browse files Browse the repository at this point in the history
  • Loading branch information
xtqqczze committed Jan 4, 2025
1 parent b33f755 commit 91a5fc2
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -88,16 +88,14 @@ internal override int EncodeUtf8(Rune value, Span<byte> destination)
}
else
{
return TryEncodeScalarAsHex(this, (uint)value.Value, destination);
return TryEncodeScalarAsHex((uint)value.Value, destination);
}

OutOfSpace:

return -1;

#pragma warning disable IDE0060 // 'this' taken explicitly to avoid argument shuffling by caller
static int TryEncodeScalarAsHex(object @this, uint scalarValue, Span<byte> destination)
#pragma warning restore IDE0060
static int TryEncodeScalarAsHex(uint scalarValue, Span<byte> destination)
{
UnicodeDebug.AssertIsValidScalar(scalarValue);

Expand Down Expand Up @@ -154,16 +152,14 @@ internal override int EncodeUtf16(Rune value, Span<char> destination)
}
else
{
return TryEncodeScalarAsHex(this, (uint)value.Value, destination);
return TryEncodeScalarAsHex((uint)value.Value, destination);
}

OutOfSpace:

return -1;

#pragma warning disable IDE0060 // 'this' taken explicitly to avoid argument shuffling by caller
static int TryEncodeScalarAsHex(object @this, uint scalarValue, Span<char> destination)
#pragma warning restore IDE0060
static int TryEncodeScalarAsHex(uint scalarValue, Span<char> destination)
{
UnicodeDebug.AssertIsValidScalar(scalarValue);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,11 +123,9 @@ internal override int EncodeUtf8(Rune value, Span<byte> destination)
return -1;
}

return TryEncodeScalarAsHex(this, value, destination);
return TryEncodeScalarAsHex(value, destination);

#pragma warning disable IDE0060 // 'this' taken explicitly to avoid argument shuffling by caller
static int TryEncodeScalarAsHex(object @this, Rune value, Span<byte> destination)
#pragma warning restore IDE0060
static int TryEncodeScalarAsHex(Rune value, Span<byte> destination)
{
if (value.IsBmp)
{
Expand Down Expand Up @@ -174,11 +172,9 @@ internal override int EncodeUtf16(Rune value, Span<char> destination)
return -1;
}

return TryEncodeScalarAsHex(this, value, destination);
return TryEncodeScalarAsHex(value, destination);

#pragma warning disable IDE0060 // 'this' taken explicitly to avoid argument shuffling by caller
static int TryEncodeScalarAsHex(object @this, Rune value, Span<char> destination)
#pragma warning restore IDE0060
static int TryEncodeScalarAsHex(Rune value, Span<char> destination)
{
if (value.IsBmp)
{
Expand Down

2 comments on commit 91a5fc2

@xtqqczze
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@xtqqczze
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.