Unnecessary case removed.

This commit is contained in:
mlemanczyk committed 2023-01-29 14:07:34 +01:00
1 parent 604ee06697
commit 96f4912cd3
1 file changed
+3 -10
+3 -10
View File
@@ -83,16 +83,14 @@ namespace Recyclable.Collections
var sourceBlockCount = source?.Length ?? 0;
int requiredBlockCount = (int)(newCapacity / blockSize) + (newCapacity % blockSize > 0 ? 1 : 0);
Span<T[]> sourceSpan, newArraySpan;
T[][] newMemoryBlocks = requiredBlockCount >= RecyclableDefaults.MinPooledArrayLength
? arrayPool.Rent(requiredBlockCount)
: new T[requiredBlockCount][];
switch (sourceBlockCount > 0)
var newArraySpan = new Span<T[]>(newMemoryBlocks);
if (sourceBlockCount > 0)
{
case true:
sourceSpan = new Span<T[]>(source);
newArraySpan = new Span<T[]>(newMemoryBlocks);
var sourceSpan = new Span<T[]>(source);
sourceSpan.CopyTo(newArraySpan);
if (sourceSpan.Length >= RecyclableDefaults.MinPooledArrayLength)
{
@@ -100,11 +98,6 @@ namespace Recyclable.Collections
}
newArraySpan = newArraySpan[sourceBlockCount..];
break;
case false:
newArraySpan = new Span<T[]>(newMemoryBlocks);
break;
}
int uninitializedBlocksCount = newArraySpan.Length;