Skip to content

Commit

Permalink
Address code warnings from net9 preview.3 (#648)
Browse files Browse the repository at this point in the history
  • Loading branch information
viceroypenguin authored Apr 11, 2024
1 parent 4beaa35 commit 56b9467
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 4 deletions.
1 change: 0 additions & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,6 @@ dotnet_diagnostic.IDE0043.severity = error # IDE0043: Format string
dotnet_diagnostic.IDE0051.severity = warning # IDE0051: Remove unused private member
dotnet_diagnostic.IDE0052.severity = warning # IDE0052: Remove unread private member
dotnet_diagnostic.IDE0076.severity = warning # IDE0076: Remove invalid global 'SuppressMessageAttribute'
dotnet_diagnostic.IDE0305.severity = suggestion # IDE0305: Simplify collection initialization

# XML Documentation
dotnet_diagnostic.CS0105.severity = error # CS0105: Using directive is unnecessary.
Expand Down
1 change: 1 addition & 0 deletions Source/SuperLinq/Memoize.cs
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,7 @@ public IEnumerator<T> GetEnumerator()
return GetEnumeratorImpl(buffer);
}

[SuppressMessage("Style", "IDE0305:Simplify collection initialization")]
private T[] InitializeBuffer()
{
var source = _source;
Expand Down
3 changes: 3 additions & 0 deletions Source/SuperLinq/WindowLeft.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
using System.Diagnostics.CodeAnalysis;

namespace SuperLinq;

public static partial class SuperEnumerable
Expand Down Expand Up @@ -93,6 +95,7 @@ int size
{
public override int Count => source.Count;

[SuppressMessage("Style", "IDE0305:Simplify collection initialization")]
protected override IEnumerable<IList<T>> GetEnumerable()
{
T[] window;
Expand Down
5 changes: 4 additions & 1 deletion Tests/SuperLinq.Test/ToArrayByIndexTest.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
namespace Test;
using System.Diagnostics.CodeAnalysis;

namespace Test;

public sealed class ToArrayByIndexTest
{
Expand All @@ -17,6 +19,7 @@ public sealed class ToArrayByIndexTest
[InlineData(true, new[] { 0, 5, 9 })]
[InlineData(true, new[] { 2, 3, 5, 9 })]
[InlineData(true, new[] { 5, 2, 9, 3 })]
[SuppressMessage("Style", "IDE0305:Simplify collection initialization")]
public void ToArrayByIndex(bool withLength, int[] indices)
{
using var input = indices
Expand Down
4 changes: 2 additions & 2 deletions Tests/SuperLinq.Test/UpdatablePriorityQueueTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -247,8 +247,8 @@ public void UpdatablePriorityQueue_Enumeration_OrderingIsConsistent(int count)
{
var queue = CreateUpdatablePriorityQueue(initialCapacity: 0, count, out _);

(TElement, TPriority)[] firstEnumeration = queue.UnorderedItems.ToArray();
(TElement, TPriority)[] secondEnumeration = queue.UnorderedItems.ToArray();
var firstEnumeration = queue.UnorderedItems.ToArray();
var secondEnumeration = queue.UnorderedItems.ToArray();

Assert.Equal(firstEnumeration.Length, count);
Assert.True(firstEnumeration.SequenceEqual(secondEnumeration));
Expand Down

0 comments on commit 56b9467

Please sign in to comment.