Skip to content

Commit 8f587ac

Browse files
committed
Fix Analyzer warnings blocking release
1 parent be2f230 commit 8f587ac

7 files changed

Lines changed: 23 additions & 22 deletions

File tree

Funcky.Test/TestUtilities/RepeatingSequence.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,11 @@ public async Task<bool> NTimes(int count)
3838
.Range(0, count)
3939
.AggregateAsync(true, AggregateEquality);
4040

41-
public async ValueTask<bool> AggregateEquality(bool b, int i, CancellationToken token)
41+
public async ValueTask<bool> AggregateEquality(bool b, int i, CancellationToken cancellationToken)
4242
=> b && await _sequence
43-
.Skip(i * await _pattern.CountAsync(token))
43+
.Skip(i * await _pattern.CountAsync(cancellationToken))
4444
.Zip(_pattern, (l, r) => l == r)
45-
.AllAsync(Identity, token);
45+
.AllAsync(Identity, cancellationToken);
4646
}
4747
#endif
4848
}

Funcky/AsyncSequence/AsyncSequence.Successors.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ public static partial class AsyncSequence
55
{
66
/// <summary>
77
/// Generates a sequence based on a <paramref name="successor"/> function stopping at the first <see cref="Option{TItem}.None"/> value.
8-
/// This is essentially the inverse operation of an <see cref="AsyncEnumerable.AggregateAsync{T}"/>.
8+
/// This is essentially the inverse operation of an <see cref="System.Linq.AsyncEnumerable.AggregateAsync{TSource}(System.Collections.Generic.IAsyncEnumerable{TSource}, System.Func{TSource, TSource, System.Threading.CancellationToken, System.Threading.Tasks.ValueTask{TSource}}, System.Threading.CancellationToken)"/>.
99
/// </summary>
1010
/// <param name="first">The first element of the sequence.</param>
1111
/// <param name="successor">Generates the next element of the sequence or <see cref="Option{TItem}.None"/> based on the previous item.</param>

Funcky/Extensions/AsyncEnumerableExtensions/Interleave.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,14 +35,14 @@ private static async IAsyncEnumerable<TSource> InterleaveInternal<TSource>(
3535

3636
try
3737
{
38-
await foreach (var element in InterleaveEnumeratorAsync(enumerators).ConfigureAwait(false))
38+
await foreach (var element in InterleaveEnumeratorAsync(enumerators, cancellationToken).ConfigureAwait(false))
3939
{
4040
yield return element;
4141
}
4242
}
4343
finally
4444
{
45-
await foreach (var enumerator in enumerators.ToAsyncEnumerable())
45+
await foreach (var enumerator in enumerators.ToAsyncEnumerable().WithCancellation(cancellationToken).ConfigureAwait(false))
4646
{
4747
await DisposeEnumerator(enumerator).ConfigureAwait(false);
4848
}
@@ -58,11 +58,11 @@ private static ImmutableList<IAsyncEnumerator<TSource>> GetInterleaveEnumerators
5858
CancellationToken cancellationToken)
5959
=> source.Select(s => s.GetAsyncEnumerator(cancellationToken)).ToImmutableList();
6060

61-
private static async IAsyncEnumerable<TSource> InterleaveEnumeratorAsync<TSource>(ImmutableList<IAsyncEnumerator<TSource>> enumerators)
61+
private static async IAsyncEnumerable<TSource> InterleaveEnumeratorAsync<TSource>(ImmutableList<IAsyncEnumerator<TSource>> enumerators, [EnumeratorCancellation] CancellationToken cancellationToken)
6262
{
6363
while (!enumerators.IsEmpty)
6464
{
65-
enumerators = enumerators.RemoveRange(await enumerators.ToAsyncEnumerable().Where(async (f, _) => await HasMoreElements(f).ConfigureAwait(false)).ToListAsync().ConfigureAwait(false));
65+
enumerators = enumerators.RemoveRange(await enumerators.ToAsyncEnumerable().Where(async (f, _) => await HasMoreElements(f).ConfigureAwait(false)).ToListAsync(cancellationToken).ConfigureAwait(false));
6666
foreach (var enumerator in enumerators)
6767
{
6868
yield return enumerator.Current;

Funcky/Extensions/AsyncEnumerableExtensions/MaxOrNone.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ public static ValueTask<Option<TResult>> MaxOrNoneAsync<TSource, TResult>(this I
5454
[Pure]
5555
public static ValueTask<Option<TResult>> MaxOrNoneAwaitAsync<TSource, TResult>(this IAsyncEnumerable<TSource> source, Func<TSource, ValueTask<TResult>> selector, CancellationToken cancellationToken = default)
5656
where TResult : notnull
57-
=> source.Select(selector).AggregateAsync(Option<TResult>.None, async (min, current, _) => MaxAggregator.Aggregate(min, await current), cancellationToken);
57+
=> source.Select(selector).AggregateAsync(Option<TResult>.None, async (min, current, _) => MaxAggregator.Aggregate(min, await current.ConfigureAwait(false)), cancellationToken);
5858

5959
/// <summary>
6060
/// Invokes a transform function on each element of a sequence and returns the maximum from the generic values compared by a <see cref="Comparer{T}"/>. If the transformed sequence only consists of none or is empty it returns None.

Funcky/Extensions/AsyncEnumerableExtensions/MinOrNone.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ public static ValueTask<Option<TResult>> MinOrNoneAsync<TSource, TResult>(this I
5454
[Pure]
5555
public static ValueTask<Option<TResult>> MinOrNoneAwaitAsync<TSource, TResult>(this IAsyncEnumerable<TSource> source, Func<TSource, ValueTask<TResult>> selector, CancellationToken cancellationToken = default)
5656
where TResult : notnull
57-
=> source.Select(selector).AggregateAsync(Option<TResult>.None, async (min, current, _) => MinAggregator.Aggregate(min, await current), cancellationToken);
57+
=> source.Select(selector).AggregateAsync(Option<TResult>.None, async (min, current, _) => MinAggregator.Aggregate(min, await current.ConfigureAwait(false)), cancellationToken);
5858

5959
/// <summary>
6060
/// Invokes a transform function on each element of a sequence and returns the minimum from the generic values compared by a <see cref="Comparer{T}"/>. If the transformed sequence only consists of none or is empty it returns None.

Funcky/Funcky.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
<EnableNETAnalyzers>true</EnableNETAnalyzers>
1818
<AnalysisModeReliability>All</AnalysisModeReliability>
1919
<EnablePackageValidation>true</EnablePackageValidation>
20+
<NoWarn>$(NoWarn);RS0026</NoWarn><!-- RS0026: Do not add multiple overloads with optional parameters -->
2021
<PolySharpIncludeRuntimeSupportedAttributes>true</PolySharpIncludeRuntimeSupportedAttributes>
2122
</PropertyGroup>
2223
<PropertyGroup>

0 commit comments

Comments
 (0)