Skip to content

Commit

Permalink
Remove useless assignment to local variable
Browse files Browse the repository at this point in the history
  • Loading branch information
rdeago committed Feb 23, 2024
1 parent 5300503 commit 612985a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/Louis/IO/ReadOnlyMemoryStream.cs
Original file line number Diff line number Diff line change
Expand Up @@ -646,7 +646,6 @@ private int EmulateRead(int count)

private void CopyToInternal(Stream destination, int originalPosition)
{
var remaining = _position - originalPosition;
#if NETCOREAPP2_1_OR_GREATER || NETSTANDARD2_1_OR_GREATER
// On runtimes that have Stream.Write(ReadOnlySpan<byte>), just use that.
destination.Write(_data.Span[originalPosition.._position]);
Expand All @@ -656,6 +655,7 @@ private void CopyToInternal(Stream destination, int originalPosition)
// Fortunately, MemoryMarshal can tell us whether this is the case
// and provide us with a reference to the array and the starting index
// of the ReadOnlyMemory, sparing us the use of ArrayPool for a temporary array.
var remaining = _position - originalPosition;
if (MemoryMarshal.TryGetArray(_data, out var dataArray))
{
// If our data is actually in an array, write directly from that.
Expand Down

0 comments on commit 612985a

Please sign in to comment.