Collapse AsSpan().Slice(..) into AsSpan(..) (#1991)
This commit is contained in:
parent
16c6a65bf2
commit
0ee4a86564
|
|
@ -288,7 +288,7 @@ namespace Microsoft.AspNetCore.Internal
|
|||
#if NETCOREAPP2_1
|
||||
public override void Write(ReadOnlySpan<byte> span)
|
||||
{
|
||||
if (_currentSegment != null && span.TryCopyTo(_currentSegment.AsSpan().Slice(_position)))
|
||||
if (_currentSegment != null && span.TryCopyTo(_currentSegment.AsSpan(_position)))
|
||||
{
|
||||
_position += span.Length;
|
||||
_bytesWritten += span.Length;
|
||||
|
|
|
|||
|
|
@ -107,7 +107,7 @@ namespace Microsoft.AspNetCore.SignalR.Tests
|
|||
var result = await ws.ReceiveAsync(buffer, CancellationToken.None).OrTimeout();
|
||||
logger.LogInformation("Received {length} byte frame", result.Count);
|
||||
|
||||
Assert.Equal(bytes, buffer.Array.AsSpan().Slice(0, result.Count).ToArray());
|
||||
Assert.Equal(bytes, buffer.Array.AsSpan(0, result.Count).ToArray());
|
||||
|
||||
logger.LogInformation("Closing socket");
|
||||
await ws.CloseOutputAsync(WebSocketCloseStatus.Empty, "", CancellationToken.None).OrTimeout();
|
||||
|
|
@ -145,7 +145,7 @@ namespace Microsoft.AspNetCore.SignalR.Tests
|
|||
var result = await ws.ReceiveAsync(buffer, CancellationToken.None).OrTimeout();
|
||||
logger.LogInformation("Received {length} byte frame", result.Count);
|
||||
|
||||
Assert.Equal(bytes, buffer.Array.AsSpan().Slice(0, result.Count).ToArray());
|
||||
Assert.Equal(bytes, buffer.Array.AsSpan(0, result.Count).ToArray());
|
||||
|
||||
logger.LogInformation("Closing socket");
|
||||
await ws.CloseOutputAsync(WebSocketCloseStatus.Empty, "", CancellationToken.None).OrTimeout();
|
||||
|
|
|
|||
Loading…
Reference in New Issue