Skip to content

Commit

Permalink
remove some redundant type parameters (#6713)
Browse files Browse the repository at this point in the history
Co-authored-by: Aaron Stannard <[email protected]>
  • Loading branch information
SimonCropp and Aaronontheweb authored May 8, 2023
1 parent f7a5977 commit 95b6227
Show file tree
Hide file tree
Showing 22 changed files with 65 additions and 65 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public class StatsSampleSpecConfig : MultiNodeConfig
public readonly RoleName Second;
public readonly RoleName Third;

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

public StatsSampleSpecConfig()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,11 @@ void Assert<T>(ImmutableHashSet<(string shard, Task<T> task)> responses)
qr.ToString().Should().Be($"Queried [3] shards: [2] responsive, [1] failed after {timeout}.");
}

Assert<ShardStats>(ImmutableHashSet.Create<(string shard, Task<ShardStats> task)>(
Assert(ImmutableHashSet.Create<(string shard, Task<ShardStats> task)>(
("a", Task.FromResult(new ShardStats("a", 1))),
("b", Task.FromResult(new ShardStats("b", 1)))));

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

Assert<ShardStats>(ImmutableHashSet.Create<(string shard, Task<ShardStats> task)>(
Assert(ImmutableHashSet.Create<(string shard, Task<ShardStats> task)>(
("a", Task.FromResult(new ShardStats("a", 1))),
("b", Task.FromResult(new ShardStats("b", 1)))));

Assert<CurrentShardState>(ImmutableHashSet.Create<(string shard, Task<CurrentShardState> task)>(
Assert(ImmutableHashSet.Create<(string shard, Task<CurrentShardState> task)>(
("a", Task.FromResult(new CurrentShardState("a", ImmutableHashSet.Create("a1")))),
("b", Task.FromResult(new CurrentShardState("b", ImmutableHashSet.Create("b1"))))));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ Task<IImmutableSet<ShardId>> RebalancePhase2(

if (result1.Count > 0)
{
return Task.FromResult<IImmutableSet<ShardId>>(result1);
return Task.FromResult(result1);
}
else
{
Expand Down
4 changes: 2 additions & 2 deletions src/core/Akka.Cluster.Tests.MultiNode/SingletonClusterSpec.cs
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ public void Cluster_of_2_nodes_must_become_singleton_cluster_when_started_with_s
{
RunOn(() =>
{
var nodes = ImmutableList.Create<Address>(GetAddress(_config.First));
var nodes = ImmutableList.Create(GetAddress(_config.First));
Cluster.JoinSeedNodes(nodes);
AwaitMembersUp(1);
ClusterView.IsSingletonCluster.ShouldBeTrue();
Expand All @@ -102,7 +102,7 @@ public void Cluster_of_2_nodes_must_become_singleton_cluster_when_one_node_is_sh

MarkNodeAsUnavailable(secondAddress);

AwaitMembersUp(1, ImmutableHashSet.Create<Address>(secondAddress), TimeSpan.FromSeconds(30));
AwaitMembersUp(1, ImmutableHashSet.Create(secondAddress), TimeSpan.FromSeconds(30));
ClusterView.IsSingletonCluster.ShouldBeTrue();
AwaitCondition(() => ClusterView.IsLeader);
}, _config.First);
Expand Down
6 changes: 3 additions & 3 deletions src/core/Akka.Cluster.Tests.MultiNode/StressSpec.cs
Original file line number Diff line number Diff line change
Expand Up @@ -914,7 +914,7 @@ string FormatSeedJoin()
CreateResultAggregator(title, expectedResults: currentRoles.Length, true);
RunOn(() =>
{
ReportResult<bool>(() =>
ReportResult(() =>
{
RunOn(() =>
{
Expand Down Expand Up @@ -1050,7 +1050,7 @@ string FormatNodeLeave()

RunOn(() =>
{
ReportResult<bool>(() =>
ReportResult(() =>
{
RunOn(() =>
{
Expand Down Expand Up @@ -1101,7 +1101,7 @@ public void PartitionSeveral(int numberOfNodes)

RunOn(() =>
{
ReportResult<bool>(() =>
ReportResult(() =>
{
var startTime = MonotonicClock.GetTicks();
AwaitMembersUp(currentRoles.Length, timeout:RemainingOrDefault);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public async Task ClusterHeartbeatReceiver_should_respond_to_heartbeats_with_sam
{
var heartbeater = Sys.ActorOf(ClusterHeartbeatReceiver.Props(Cluster.Get(Sys)));
heartbeater.Tell(new Heartbeat(Cluster.Get(Sys).SelfAddress, 1, 2));
await ExpectMsgAsync<HeartbeatRsp>(new HeartbeatRsp(Cluster.Get(Sys).SelfUniqueAddress, 1, 2));
await ExpectMsgAsync(new HeartbeatRsp(Cluster.Get(Sys).SelfUniqueAddress, 1, 2));
}

[Fact]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public void PersistentActor_with_Timer_must_not_discard_timer_msg_due_to_stashin
{
var pa = ActorOf(TestPersistentActor.TestProps("p1"));
pa.Tell("msg1");
ExpectMsg<string>("msg1");
ExpectMsg("msg1");
}

[Fact]
Expand Down
12 changes: 6 additions & 6 deletions src/core/Akka.Persistence/PersistentActor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -439,7 +439,7 @@ private void EnsureMayConfigureRecoverHandlers()
protected void Recover<T>(Action<T> handler, Predicate<T> shouldHandle = null)
{
EnsureMayConfigureRecoverHandlers();
_matchRecoverBuilders.Peek().Match<T>(handler, shouldHandle);
_matchRecoverBuilders.Peek().Match(handler, shouldHandle);
}

/// <summary>
Expand All @@ -450,7 +450,7 @@ protected void Recover<T>(Action<T> handler, Predicate<T> shouldHandle = null)
/// <param name="handler">TBD</param>
protected void Recover<T>(Predicate<T> shouldHandle, Action<T> handler)
{
Recover<T>(handler, shouldHandle);
Recover(handler, shouldHandle);
}

/// <summary>
Expand Down Expand Up @@ -484,7 +484,7 @@ protected void Recover(Type messageType, Predicate<object> shouldHandle, Action<
protected void Recover<T>(Func<T, bool> handler)
{
EnsureMayConfigureRecoverHandlers();
_matchRecoverBuilders.Peek().Match<T>(handler);
_matchRecoverBuilders.Peek().Match(handler);
}

/// <summary>
Expand Down Expand Up @@ -609,7 +609,7 @@ protected void CommandAnyAsync(Func<object, Task> handler)
protected void Command<T>(Action<T> handler, Predicate<T> shouldHandle = null)
{
EnsureMayConfigureCommandHandlers();
_matchCommandBuilders.Peek().Match<T>(handler, shouldHandle);
_matchCommandBuilders.Peek().Match(handler, shouldHandle);
}

/// <summary>
Expand All @@ -620,7 +620,7 @@ protected void Command<T>(Action<T> handler, Predicate<T> shouldHandle = null)
/// <param name="handler">TBD</param>
protected void Command<T>(Predicate<T> shouldHandle, Action<T> handler)
{
Command<T>(handler, shouldHandle);
Command(handler, shouldHandle);
}

/// <summary>
Expand Down Expand Up @@ -654,7 +654,7 @@ protected void Command(Type messageType, Predicate<object> shouldHandle, Action<
protected void Command<T>(Func<T, bool> handler)
{
EnsureMayConfigureCommandHandlers();
_matchCommandBuilders.Peek().Match<T>(handler);
_matchCommandBuilders.Peek().Match(handler);
}

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,12 +76,12 @@ public void RemoteReDeployment_must_terminate_the_child_when_its_parent_system_i
Sys.ActorOf(Props.Create(() => new Parent()), "parent")
.Tell(new ParentMessage(Props.Create(() => new Hello()), "hello"));

ExpectMsg<string>("HelloParent", TimeSpan.FromSeconds(15));
ExpectMsg("HelloParent", TimeSpan.FromSeconds(15));
}, _config.Second);

RunOn(() =>
{
ExpectMsg<string>("PreStart", TimeSpan.FromSeconds(15));
ExpectMsg("PreStart", TimeSpan.FromSeconds(15));

}, _config.First);

Expand Down
2 changes: 1 addition & 1 deletion src/core/Akka.Streams.Tests/Dsl/RestartSpec.cs
Original file line number Diff line number Diff line change
Expand Up @@ -792,7 +792,7 @@ await this.AssertAllStagesStoppedAsync(async () =>
var created = new AtomicCounter(0);
const int restarts = 4;

var flow = RestartFlowFactory<int, int, NotUsed>(() =>
var flow = RestartFlowFactory(() =>
{
created.IncrementAndGet();
return Flow.Create<int>()
Expand Down
2 changes: 1 addition & 1 deletion src/core/Akka.Streams/CodeGen/Dsl/GraphApply.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public partial class GraphDsl
/// <returns>A graph with no materialized value.</returns>
public static IGraph<TShape, NotUsed> Create<TShape>(Func<Builder<NotUsed>, TShape> buildBlock)
where TShape : Shape
=> CreateMaterialized<TShape, NotUsed>(buildBlock);
=> CreateMaterialized(buildBlock);

/// <summary>
/// Creates a new <see cref="IGraph{TShape, TMat}"/> by passing a <see cref="Builder{TMat}"/> to the given create function.
Expand Down
2 changes: 1 addition & 1 deletion src/core/Akka.Streams/Dsl/RestartFlow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ public Logic(RestartWithBackoffFlow<TIn, TOut, TMat> stage, Attributes inherited
: base(name, stage.Shape, stage.In, stage.Out, stage.Settings, stage.OnlyOnFailures)
{
_inheritedAttributes = inheritedAttributes;
_delay = _inheritedAttributes.GetAttribute<RestartWithBackoffFlow.Delay>(new RestartWithBackoffFlow.Delay(TimeSpan.FromMilliseconds(50))).Duration;
_delay = _inheritedAttributes.GetAttribute(new RestartWithBackoffFlow.Delay(TimeSpan.FromMilliseconds(50))).Duration;
_stage = stage;
Backoff();
}
Expand Down
4 changes: 2 additions & 2 deletions src/core/Akka.Streams/Dsl/StreamRefs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public static class StreamRefs
/// <seealso cref="SourceRef{T}"/>
[ApiMayChange]
public static Sink<T, Task<ISourceRef<T>>> SourceRef<T>() =>
Sink.FromGraph<T, Task<ISourceRef<T>>>(new SinkRefStageImpl<T>(null));
Sink.FromGraph(new SinkRefStageImpl<T>(null));

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

/// <summary>
Expand Down
2 changes: 1 addition & 1 deletion src/core/Akka.Tests.Shared.Internals/ActorDslExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public static class ActorDslExtensions
{
public static void Receive(this IActorDsl config, string message, Action<string, IActorContext> handler)
{
config.Receive<string>(m=>string.Equals(m,message,StringComparison.Ordinal), handler);
config.Receive(m=>string.Equals(m,message,StringComparison.Ordinal), handler);
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/core/Akka.Tests.Shared.Internals/TestReceiveActor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public class TestReceiveActor : ReceiveActor
{
public void Receive<T>(T value, Action<T> handler) where T : IEquatable<T>
{
Receive<T>(m => Equals(value, m), handler);
Receive(m => Equals(value, m), handler);
}

}
Expand Down
4 changes: 2 additions & 2 deletions src/core/Akka.Tests/Actor/RemotePathParsingSpec.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ public static Arbitrary<IPEndPoint> IpEndPoints()
{
// TODO: Mono does not support IPV6 Uris correctly https://bugzilla.xamarin.com/show_bug.cgi?id=43649 (Aaronontheweb 9/13/2016)
if (IsMono)
return Arb.From(Gen.Elements<IPEndPoint>(new IPEndPoint(IPAddress.Loopback, 1337),
return Arb.From(Gen.Elements(new IPEndPoint(IPAddress.Loopback, 1337),
new IPEndPoint(IPAddress.Any, 1337)));
return Arb.From(Gen.Elements<IPEndPoint>(new IPEndPoint(IPAddress.Loopback, 1337),
return Arb.From(Gen.Elements(new IPEndPoint(IPAddress.Loopback, 1337),
new IPEndPoint(IPAddress.IPv6Loopback, 1337),
new IPEndPoint(IPAddress.Any, 1337), new IPEndPoint(IPAddress.IPv6Any, 1337)));
}
Expand Down
4 changes: 2 additions & 2 deletions src/core/Akka.Tests/IO/TcpIntegrationSpec.cs
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ public async Task The_TCP_transport_implementation_should_properly_support_conne
var testData = ByteString.FromString(str);
clientEp.Tell(Tcp.Write.Create(testData, Ack.Instance), clientHandler);
await clientHandler.ExpectMsgAsync<Ack>();
var received = await serverHandler.ReceiveWhileAsync<Tcp.Received>(o =>
var received = await serverHandler.ReceiveWhileAsync(o =>
{
return o as Tcp.Received;
}, RemainingOrDefault, TimeSpan.FromSeconds(0.5)).ToListAsync();
Expand All @@ -219,7 +219,7 @@ public async Task BugFix_3021_Tcp_Should_not_drop_large_messages()
actors.ClientHandler.Send(actors.ClientConnection, Tcp.Write.Create(testData));
actors.ClientHandler.Send(actors.ClientConnection, Tcp.Write.Create(testData));

var serverMsgs = await actors.ServerHandler.ReceiveWhileAsync<Tcp.Received>(o =>
var serverMsgs = await actors.ServerHandler.ReceiveWhileAsync(o =>
{
return o as Tcp.Received;
}, RemainingOrDefault, TimeSpan.FromSeconds(2)).ToListAsync();
Expand Down
2 changes: 1 addition & 1 deletion src/core/Akka.Tests/Routing/RouteeCreationSpec.cs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public async Task Creating_routees_must_allow_sending_to_context_parent()
{
int n = 100;
Sys.ActorOf(new RoundRobinPool(n).Props(Props.Create(() => new ForwardActor(TestActor))));
var gotIt = await ReceiveWhileAsync<string>(msg =>
var gotIt = await ReceiveWhileAsync(msg =>
{
if (msg.Equals("two"))
{
Expand Down
6 changes: 3 additions & 3 deletions src/core/Akka/Actor/CoordinatedShutdown.cs
Original file line number Diff line number Diff line change
Expand Up @@ -421,7 +421,7 @@ Task<Done> Loop(List<string> remainingPhases)

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

phaseResult = Task.WhenAny<Done>(result, timeoutFunction).Unwrap();
phaseResult = Task.WhenAny(result, timeoutFunction).Unwrap();
}

if (!remaining.Any())
Expand All @@ -505,7 +505,7 @@ Task<Done> Loop(List<string> remainingPhases)
var r = tr.Result;
return Loop(remaining);
})
.Unwrap<Done>();
.Unwrap();
}

var runningPhases = (fromPhase == null
Expand Down
6 changes: 3 additions & 3 deletions src/core/Akka/Actor/ReceiveActor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ protected void ReceiveAnyAsync(Func<object, Task> handler)
protected void Receive<T>(Action<T> handler, Predicate<T> shouldHandle = null)
{
EnsureMayConfigureMessageHandlers();
_matchHandlerBuilders.Peek().Match<T>(handler, shouldHandle);
_matchHandlerBuilders.Peek().Match(handler, shouldHandle);
}

/// <summary>
Expand All @@ -227,7 +227,7 @@ protected void Receive<T>(Action<T> handler, Predicate<T> shouldHandle = null)
/// <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>
protected void Receive<T>(Predicate<T> shouldHandle, Action<T> handler)
{
Receive<T>(handler, shouldHandle);
Receive(handler, shouldHandle);
}

/// <summary>
Expand Down Expand Up @@ -279,7 +279,7 @@ protected void Receive(Type messageType, Predicate<object> shouldHandle, Action<
protected void Receive<T>(Func<T, bool> handler)
{
EnsureMayConfigureMessageHandlers();
_matchHandlerBuilders.Peek().Match<T>(handler);
_matchHandlerBuilders.Peek().Match(handler);
}

/// <summary>
Expand Down
Loading

0 comments on commit 95b6227

Please sign in to comment.