Code readability improvements - nullability checks disabled for memory blocks, to avoid hint suppression in code.
This commit is contained in:
1 parent
6ebc6ac6fb
commit
c3820a61d9
2 files changed
+4
-10
No files matched your search
@@ -13,7 +13,9 @@ namespace Recyclable.Collections
|
||||
|
||||
public static explicit operator ReadOnlySpan<T>(RecyclableList<T> source) => new(source._memoryBlock, 0, source.Count);
|
||||
|
||||
#nullable disable
|
||||
protected T[] _memoryBlock;
|
||||
#nullable restore
|
||||
// & WAS SLOWER
|
||||
// internal RecyclableCollectionVersion _version;
|
||||
// public RecyclableCollectionVersion Version => _version;
|
||||
@@ -508,9 +510,7 @@ namespace Recyclable.Collections
|
||||
|
||||
if (NeedsClearing)
|
||||
{
|
||||
#pragma warning disable CS8601 // In real use cases we'll never access it
|
||||
_memoryBlock[_count] = default;
|
||||
#pragma warning restore CS8601
|
||||
}
|
||||
|
||||
_version++;
|
||||
@@ -537,9 +537,7 @@ namespace Recyclable.Collections
|
||||
|
||||
if (NeedsClearing)
|
||||
{
|
||||
#pragma warning disable CS8601 // In real use cases we'll never access it
|
||||
_memoryBlock[_count] = default;
|
||||
#pragma warning restore CS8601
|
||||
}
|
||||
|
||||
_version++;
|
||||
|
||||
@@ -29,7 +29,9 @@ namespace Recyclable.Collections
|
||||
|
||||
protected ArrayPool<T[]> _memoryBlocksPool;
|
||||
protected ArrayPool<T> _blockArrayPool;
|
||||
#nullable disable
|
||||
internal T[][] _memoryBlocks;
|
||||
#nullable restore
|
||||
|
||||
private long _capacity;
|
||||
public long Capacity
|
||||
@@ -1215,9 +1217,7 @@ namespace Recyclable.Collections
|
||||
|
||||
if (NeedsClearing)
|
||||
{
|
||||
#pragma warning disable CS8601 // In real use cases we'll never access it
|
||||
_memoryBlocks[_nextItemBlockIndex][_nextItemIndex] = default;
|
||||
#pragma warning restore CS8601
|
||||
}
|
||||
|
||||
_version++;
|
||||
@@ -1285,9 +1285,7 @@ namespace Recyclable.Collections
|
||||
|
||||
if (NeedsClearing)
|
||||
{
|
||||
#pragma warning disable CS8601 // In real use cases we'll never access it
|
||||
_memoryBlocks[_nextItemBlockIndex][_nextItemIndex] = default;
|
||||
#pragma warning restore CS8601
|
||||
}
|
||||
|
||||
_version++;
|
||||
@@ -1325,9 +1323,7 @@ namespace Recyclable.Collections
|
||||
|
||||
if (NeedsClearing)
|
||||
{
|
||||
#pragma warning disable CS8601 // In real use cases we'll never access it
|
||||
_memoryBlocks[_nextItemBlockIndex][_nextItemIndex] = default;
|
||||
#pragma warning restore CS8601
|
||||
}
|
||||
|
||||
_version++;
|
||||
|
||||
Reference in new issue
Block a user