Skip to content

Commit 95b6227

Browse files
remove some redundant type parameters (#6713)
Co-authored-by: Aaron Stannard <[email protected]>
1 parent f7a5977 commit 95b6227

File tree

22 files changed

+65
-65
lines changed

22 files changed

+65
-65
lines changed

src/contrib/cluster/Akka.Cluster.Metrics.Tests.MultiNode/Sample/StatsSampleSpec.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ public class StatsSampleSpecConfig : MultiNodeConfig
2525
public readonly RoleName Second;
2626
public readonly RoleName Third;
2727

28-
public IImmutableSet<RoleName> NodeList => ImmutableHashSet.Create<RoleName>(First, Second, Third);
28+
public IImmutableSet<RoleName> NodeList => ImmutableHashSet.Create(First, Second, Third);
2929

3030
public StatsSampleSpecConfig()
3131
{

src/contrib/cluster/Akka.Cluster.Sharding.Tests/ShardingQueriesSpec.cs

+4-4
Original file line numberDiff line numberDiff line change
@@ -70,11 +70,11 @@ void Assert<T>(ImmutableHashSet<(string shard, Task<T> task)> responses)
7070
qr.ToString().Should().Be($"Queried [3] shards: [2] responsive, [1] failed after {timeout}.");
7171
}
7272

73-
Assert<ShardStats>(ImmutableHashSet.Create<(string shard, Task<ShardStats> task)>(
73+
Assert(ImmutableHashSet.Create<(string shard, Task<ShardStats> task)>(
7474
("a", Task.FromResult(new ShardStats("a", 1))),
7575
("b", Task.FromResult(new ShardStats("b", 1)))));
7676

77-
Assert<CurrentShardState>(ImmutableHashSet.Create<(string shard, Task<CurrentShardState> task)>(
77+
Assert(ImmutableHashSet.Create<(string shard, Task<CurrentShardState> task)>(
7878
("a", Task.FromResult(new CurrentShardState("a", ImmutableHashSet.Create("a1")))),
7979
("b", Task.FromResult(new CurrentShardState("b", ImmutableHashSet.Create("b1"))))));
8080
}
@@ -91,11 +91,11 @@ void Assert<T>(ImmutableHashSet<(string shard, Task<T> task)> responses)
9191
qr.ToString().Should().Be($"Queried [3] shards of [4]: [2] responsive, [1] failed after {timeout}.");
9292
}
9393

94-
Assert<ShardStats>(ImmutableHashSet.Create<(string shard, Task<ShardStats> task)>(
94+
Assert(ImmutableHashSet.Create<(string shard, Task<ShardStats> task)>(
9595
("a", Task.FromResult(new ShardStats("a", 1))),
9696
("b", Task.FromResult(new ShardStats("b", 1)))));
9797

98-
Assert<CurrentShardState>(ImmutableHashSet.Create<(string shard, Task<CurrentShardState> task)>(
98+
Assert(ImmutableHashSet.Create<(string shard, Task<CurrentShardState> task)>(
9999
("a", Task.FromResult(new CurrentShardState("a", ImmutableHashSet.Create("a1")))),
100100
("b", Task.FromResult(new CurrentShardState("b", ImmutableHashSet.Create("b1"))))));
101101
}

src/contrib/cluster/Akka.Cluster.Sharding/Internal/LeastShardAllocationStrategy.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ Task<IImmutableSet<ShardId>> RebalancePhase2(
141141

142142
if (result1.Count > 0)
143143
{
144-
return Task.FromResult<IImmutableSet<ShardId>>(result1);
144+
return Task.FromResult(result1);
145145
}
146146
else
147147
{

src/core/Akka.Cluster.Tests.MultiNode/SingletonClusterSpec.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ public void Cluster_of_2_nodes_must_become_singleton_cluster_when_started_with_s
7575
{
7676
RunOn(() =>
7777
{
78-
var nodes = ImmutableList.Create<Address>(GetAddress(_config.First));
78+
var nodes = ImmutableList.Create(GetAddress(_config.First));
7979
Cluster.JoinSeedNodes(nodes);
8080
AwaitMembersUp(1);
8181
ClusterView.IsSingletonCluster.ShouldBeTrue();
@@ -102,7 +102,7 @@ public void Cluster_of_2_nodes_must_become_singleton_cluster_when_one_node_is_sh
102102

103103
MarkNodeAsUnavailable(secondAddress);
104104

105-
AwaitMembersUp(1, ImmutableHashSet.Create<Address>(secondAddress), TimeSpan.FromSeconds(30));
105+
AwaitMembersUp(1, ImmutableHashSet.Create(secondAddress), TimeSpan.FromSeconds(30));
106106
ClusterView.IsSingletonCluster.ShouldBeTrue();
107107
AwaitCondition(() => ClusterView.IsLeader);
108108
}, _config.First);

src/core/Akka.Cluster.Tests.MultiNode/StressSpec.cs

+3-3
Original file line numberDiff line numberDiff line change
@@ -914,7 +914,7 @@ string FormatSeedJoin()
914914
CreateResultAggregator(title, expectedResults: currentRoles.Length, true);
915915
RunOn(() =>
916916
{
917-
ReportResult<bool>(() =>
917+
ReportResult(() =>
918918
{
919919
RunOn(() =>
920920
{
@@ -1050,7 +1050,7 @@ string FormatNodeLeave()
10501050

10511051
RunOn(() =>
10521052
{
1053-
ReportResult<bool>(() =>
1053+
ReportResult(() =>
10541054
{
10551055
RunOn(() =>
10561056
{
@@ -1101,7 +1101,7 @@ public void PartitionSeveral(int numberOfNodes)
11011101

11021102
RunOn(() =>
11031103
{
1104-
ReportResult<bool>(() =>
1104+
ReportResult(() =>
11051105
{
11061106
var startTime = MonotonicClock.GetTicks();
11071107
AwaitMembersUp(currentRoles.Length, timeout:RemainingOrDefault);

src/core/Akka.Cluster.Tests/ClusterHeartbeatReceiverSpec.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ public async Task ClusterHeartbeatReceiver_should_respond_to_heartbeats_with_sam
5151
{
5252
var heartbeater = Sys.ActorOf(ClusterHeartbeatReceiver.Props(Cluster.Get(Sys)));
5353
heartbeater.Tell(new Heartbeat(Cluster.Get(Sys).SelfAddress, 1, 2));
54-
await ExpectMsgAsync<HeartbeatRsp>(new HeartbeatRsp(Cluster.Get(Sys).SelfUniqueAddress, 1, 2));
54+
await ExpectMsgAsync(new HeartbeatRsp(Cluster.Get(Sys).SelfUniqueAddress, 1, 2));
5555
}
5656

5757
[Fact]

src/core/Akka.Persistence.Tests/TimerPersistentActorSpec.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ public void PersistentActor_with_Timer_must_not_discard_timer_msg_due_to_stashin
3333
{
3434
var pa = ActorOf(TestPersistentActor.TestProps("p1"));
3535
pa.Tell("msg1");
36-
ExpectMsg<string>("msg1");
36+
ExpectMsg("msg1");
3737
}
3838

3939
[Fact]

src/core/Akka.Persistence/PersistentActor.cs

+6-6
Original file line numberDiff line numberDiff line change
@@ -439,7 +439,7 @@ private void EnsureMayConfigureRecoverHandlers()
439439
protected void Recover<T>(Action<T> handler, Predicate<T> shouldHandle = null)
440440
{
441441
EnsureMayConfigureRecoverHandlers();
442-
_matchRecoverBuilders.Peek().Match<T>(handler, shouldHandle);
442+
_matchRecoverBuilders.Peek().Match(handler, shouldHandle);
443443
}
444444

445445
/// <summary>
@@ -450,7 +450,7 @@ protected void Recover<T>(Action<T> handler, Predicate<T> shouldHandle = null)
450450
/// <param name="handler">TBD</param>
451451
protected void Recover<T>(Predicate<T> shouldHandle, Action<T> handler)
452452
{
453-
Recover<T>(handler, shouldHandle);
453+
Recover(handler, shouldHandle);
454454
}
455455

456456
/// <summary>
@@ -484,7 +484,7 @@ protected void Recover(Type messageType, Predicate<object> shouldHandle, Action<
484484
protected void Recover<T>(Func<T, bool> handler)
485485
{
486486
EnsureMayConfigureRecoverHandlers();
487-
_matchRecoverBuilders.Peek().Match<T>(handler);
487+
_matchRecoverBuilders.Peek().Match(handler);
488488
}
489489

490490
/// <summary>
@@ -609,7 +609,7 @@ protected void CommandAnyAsync(Func<object, Task> handler)
609609
protected void Command<T>(Action<T> handler, Predicate<T> shouldHandle = null)
610610
{
611611
EnsureMayConfigureCommandHandlers();
612-
_matchCommandBuilders.Peek().Match<T>(handler, shouldHandle);
612+
_matchCommandBuilders.Peek().Match(handler, shouldHandle);
613613
}
614614

615615
/// <summary>
@@ -620,7 +620,7 @@ protected void Command<T>(Action<T> handler, Predicate<T> shouldHandle = null)
620620
/// <param name="handler">TBD</param>
621621
protected void Command<T>(Predicate<T> shouldHandle, Action<T> handler)
622622
{
623-
Command<T>(handler, shouldHandle);
623+
Command(handler, shouldHandle);
624624
}
625625

626626
/// <summary>
@@ -654,7 +654,7 @@ protected void Command(Type messageType, Predicate<object> shouldHandle, Action<
654654
protected void Command<T>(Func<T, bool> handler)
655655
{
656656
EnsureMayConfigureCommandHandlers();
657-
_matchCommandBuilders.Peek().Match<T>(handler);
657+
_matchCommandBuilders.Peek().Match(handler);
658658
}
659659

660660
/// <summary>

src/core/Akka.Remote.Tests.MultiNode/RemoteReDeploymentSpec.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -76,12 +76,12 @@ public void RemoteReDeployment_must_terminate_the_child_when_its_parent_system_i
7676
Sys.ActorOf(Props.Create(() => new Parent()), "parent")
7777
.Tell(new ParentMessage(Props.Create(() => new Hello()), "hello"));
7878

79-
ExpectMsg<string>("HelloParent", TimeSpan.FromSeconds(15));
79+
ExpectMsg("HelloParent", TimeSpan.FromSeconds(15));
8080
}, _config.Second);
8181

8282
RunOn(() =>
8383
{
84-
ExpectMsg<string>("PreStart", TimeSpan.FromSeconds(15));
84+
ExpectMsg("PreStart", TimeSpan.FromSeconds(15));
8585

8686
}, _config.First);
8787

src/core/Akka.Streams.Tests/Dsl/RestartSpec.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -792,7 +792,7 @@ await this.AssertAllStagesStoppedAsync(async () =>
792792
var created = new AtomicCounter(0);
793793
const int restarts = 4;
794794

795-
var flow = RestartFlowFactory<int, int, NotUsed>(() =>
795+
var flow = RestartFlowFactory(() =>
796796
{
797797
created.IncrementAndGet();
798798
return Flow.Create<int>()

src/core/Akka.Streams/CodeGen/Dsl/GraphApply.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ public partial class GraphDsl
2525
/// <returns>A graph with no materialized value.</returns>
2626
public static IGraph<TShape, NotUsed> Create<TShape>(Func<Builder<NotUsed>, TShape> buildBlock)
2727
where TShape : Shape
28-
=> CreateMaterialized<TShape, NotUsed>(buildBlock);
28+
=> CreateMaterialized(buildBlock);
2929

3030
/// <summary>
3131
/// Creates a new <see cref="IGraph{TShape, TMat}"/> by passing a <see cref="Builder{TMat}"/> to the given create function.

src/core/Akka.Streams/Dsl/RestartFlow.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ public Logic(RestartWithBackoffFlow<TIn, TOut, TMat> stage, Attributes inherited
203203
: base(name, stage.Shape, stage.In, stage.Out, stage.Settings, stage.OnlyOnFailures)
204204
{
205205
_inheritedAttributes = inheritedAttributes;
206-
_delay = _inheritedAttributes.GetAttribute<RestartWithBackoffFlow.Delay>(new RestartWithBackoffFlow.Delay(TimeSpan.FromMilliseconds(50))).Duration;
206+
_delay = _inheritedAttributes.GetAttribute(new RestartWithBackoffFlow.Delay(TimeSpan.FromMilliseconds(50))).Duration;
207207
_stage = stage;
208208
Backoff();
209209
}

src/core/Akka.Streams/Dsl/StreamRefs.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ public static class StreamRefs
3333
/// <seealso cref="SourceRef{T}"/>
3434
[ApiMayChange]
3535
public static Sink<T, Task<ISourceRef<T>>> SourceRef<T>() =>
36-
Sink.FromGraph<T, Task<ISourceRef<T>>>(new SinkRefStageImpl<T>(null));
36+
Sink.FromGraph(new SinkRefStageImpl<T>(null));
3737

3838
/// <summary>
3939
/// A local <see cref="Sink{TIn,TMat}"/> which materializes a <see cref="SinkRef{T}"/> which can be used by other streams (including remote ones),
@@ -46,7 +46,7 @@ public static Sink<T, Task<ISourceRef<T>>> SourceRef<T>() =>
4646
/// <seealso cref="SinkRef{T}"/>
4747
[ApiMayChange]
4848
public static Source<T, Task<ISinkRef<T>>> SinkRef<T>() =>
49-
Source.FromGraph<T, Task<ISinkRef<T>>>(new SourceRefStageImpl<T>(null));
49+
Source.FromGraph(new SourceRefStageImpl<T>(null));
5050
}
5151

5252
/// <summary>

src/core/Akka.Tests.Shared.Internals/ActorDslExtensions.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ public static class ActorDslExtensions
1515
{
1616
public static void Receive(this IActorDsl config, string message, Action<string, IActorContext> handler)
1717
{
18-
config.Receive<string>(m=>string.Equals(m,message,StringComparison.Ordinal), handler);
18+
config.Receive(m=>string.Equals(m,message,StringComparison.Ordinal), handler);
1919
}
2020
}
2121
}

src/core/Akka.Tests.Shared.Internals/TestReceiveActor.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ public class TestReceiveActor : ReceiveActor
2020
{
2121
public void Receive<T>(T value, Action<T> handler) where T : IEquatable<T>
2222
{
23-
Receive<T>(m => Equals(value, m), handler);
23+
Receive(m => Equals(value, m), handler);
2424
}
2525

2626
}

src/core/Akka.Tests/Actor/RemotePathParsingSpec.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,9 @@ public static Arbitrary<IPEndPoint> IpEndPoints()
2525
{
2626
// TODO: Mono does not support IPV6 Uris correctly https://bugzilla.xamarin.com/show_bug.cgi?id=43649 (Aaronontheweb 9/13/2016)
2727
if (IsMono)
28-
return Arb.From(Gen.Elements<IPEndPoint>(new IPEndPoint(IPAddress.Loopback, 1337),
28+
return Arb.From(Gen.Elements(new IPEndPoint(IPAddress.Loopback, 1337),
2929
new IPEndPoint(IPAddress.Any, 1337)));
30-
return Arb.From(Gen.Elements<IPEndPoint>(new IPEndPoint(IPAddress.Loopback, 1337),
30+
return Arb.From(Gen.Elements(new IPEndPoint(IPAddress.Loopback, 1337),
3131
new IPEndPoint(IPAddress.IPv6Loopback, 1337),
3232
new IPEndPoint(IPAddress.Any, 1337), new IPEndPoint(IPAddress.IPv6Any, 1337)));
3333
}

src/core/Akka.Tests/IO/TcpIntegrationSpec.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ public async Task The_TCP_transport_implementation_should_properly_support_conne
195195
var testData = ByteString.FromString(str);
196196
clientEp.Tell(Tcp.Write.Create(testData, Ack.Instance), clientHandler);
197197
await clientHandler.ExpectMsgAsync<Ack>();
198-
var received = await serverHandler.ReceiveWhileAsync<Tcp.Received>(o =>
198+
var received = await serverHandler.ReceiveWhileAsync(o =>
199199
{
200200
return o as Tcp.Received;
201201
}, RemainingOrDefault, TimeSpan.FromSeconds(0.5)).ToListAsync();
@@ -219,7 +219,7 @@ public async Task BugFix_3021_Tcp_Should_not_drop_large_messages()
219219
actors.ClientHandler.Send(actors.ClientConnection, Tcp.Write.Create(testData));
220220
actors.ClientHandler.Send(actors.ClientConnection, Tcp.Write.Create(testData));
221221

222-
var serverMsgs = await actors.ServerHandler.ReceiveWhileAsync<Tcp.Received>(o =>
222+
var serverMsgs = await actors.ServerHandler.ReceiveWhileAsync(o =>
223223
{
224224
return o as Tcp.Received;
225225
}, RemainingOrDefault, TimeSpan.FromSeconds(2)).ToListAsync();

src/core/Akka.Tests/Routing/RouteeCreationSpec.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ public async Task Creating_routees_must_allow_sending_to_context_parent()
6161
{
6262
int n = 100;
6363
Sys.ActorOf(new RoundRobinPool(n).Props(Props.Create(() => new ForwardActor(TestActor))));
64-
var gotIt = await ReceiveWhileAsync<string>(msg =>
64+
var gotIt = await ReceiveWhileAsync(msg =>
6565
{
6666
if (msg.Equals("two"))
6767
{

src/core/Akka/Actor/CoordinatedShutdown.cs

+3-3
Original file line numberDiff line numberDiff line change
@@ -421,7 +421,7 @@ Task<Done> Loop(List<string> remainingPhases)
421421

422422
// note that tasks within same phase are performed in parallel
423423
var recoverEnabled = Phases[phase].Recover;
424-
var result = Task.WhenAll<Done>(phaseTasks.Select(x =>
424+
var result = Task.WhenAll(phaseTasks.Select(x =>
425425
{
426426
var taskName = x.Item1;
427427
var task = x.Item2;
@@ -493,7 +493,7 @@ Task<Done> Loop(List<string> remainingPhases)
493493
timeoutFunction = result;
494494
}
495495

496-
phaseResult = Task.WhenAny<Done>(result, timeoutFunction).Unwrap();
496+
phaseResult = Task.WhenAny(result, timeoutFunction).Unwrap();
497497
}
498498

499499
if (!remaining.Any())
@@ -505,7 +505,7 @@ Task<Done> Loop(List<string> remainingPhases)
505505
var r = tr.Result;
506506
return Loop(remaining);
507507
})
508-
.Unwrap<Done>();
508+
.Unwrap();
509509
}
510510

511511
var runningPhases = (fromPhase == null

src/core/Akka/Actor/ReceiveActor.cs

+3-3
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ protected void ReceiveAnyAsync(Func<object, Task> handler)
211211
protected void Receive<T>(Action<T> handler, Predicate<T> shouldHandle = null)
212212
{
213213
EnsureMayConfigureMessageHandlers();
214-
_matchHandlerBuilders.Peek().Match<T>(handler, shouldHandle);
214+
_matchHandlerBuilders.Peek().Match(handler, shouldHandle);
215215
}
216216

217217
/// <summary>
@@ -227,7 +227,7 @@ protected void Receive<T>(Action<T> handler, Predicate<T> shouldHandle = null)
227227
/// <exception cref="InvalidOperationException">This exception is thrown if this method is called outside of the actor's constructor or from <see cref="Become(Action)"/>.</exception>
228228
protected void Receive<T>(Predicate<T> shouldHandle, Action<T> handler)
229229
{
230-
Receive<T>(handler, shouldHandle);
230+
Receive(handler, shouldHandle);
231231
}
232232

233233
/// <summary>
@@ -279,7 +279,7 @@ protected void Receive(Type messageType, Predicate<object> shouldHandle, Action<
279279
protected void Receive<T>(Func<T, bool> handler)
280280
{
281281
EnsureMayConfigureMessageHandlers();
282-
_matchHandlerBuilders.Peek().Match<T>(handler);
282+
_matchHandlerBuilders.Peek().Match(handler);
283283
}
284284

285285
/// <summary>

0 commit comments

Comments
 (0)