Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove redundant explicit generic arguments #147

Merged
merged 1 commit into from
Apr 16, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ open class ActionConnectable<Input, Output>: Connectable {
///
/// - Parameter action: Called when the `connection`’s `accept` function is called.
public init(_ action: @escaping () -> Void) {
innerConnectable = ClosureConnectable<Input, Output>({ _ in
innerConnectable = ClosureConnectable({ _ in
action()
})
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ open class BlockingFunctionConnectable<Input, Output>: Connectable {
///
/// - Parameter function: Called when the `connection`’s `accept` function is called.
public init(_ function: @escaping (Input) -> Output) {
innerConnectable = ClosureConnectable<Input, Output>(function)
innerConnectable = ClosureConnectable(function)
}

public func connect(_ consumer: @escaping Consumer<Output>) -> Connection<Input> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ open class ConsumerConnectable<Input, Output>: Connectable {
///
/// - Parameter consumer: Called when the `connection`’s `accept` function is called.
public init(_ consumer: @escaping Consumer<Input>) {
innerConnectable = ClosureConnectable<Input, Output>(consumer)
innerConnectable = ClosureConnectable(consumer)
}

public func connect(_ consumer: @escaping Consumer<Output>) -> Connection<Input> {
Expand Down
2 changes: 1 addition & 1 deletion MobiusCore/Source/EffectHandlers/EffectRouterDSL.swift
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public extension _PartialEffectRouter {
func to(
_ handle: @escaping (EffectParameters, EffectCallback<Event>) -> Disposable
) -> EffectRouter<Effect, Event> {
return to(AnyEffectHandler<EffectParameters, Event>(handle: handle))
return to(AnyEffectHandler(handle: handle))
}

/// Route to a side-effecting closure.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public struct CompositeEventSourceBuilder<Event> {
/// Returns a new `CompositeEventSourceBuilder` with the specified event source added to it.
public func addEventSource<Source: EventSource>(_ source: Source)
-> CompositeEventSourceBuilder<Event> where Source.Event == Event {
let sources = eventSources + [AnyEventSource<Event>(source)]
let sources = eventSources + [AnyEventSource(source)]
return CompositeEventSourceBuilder(eventSources: sources)
}

Expand All @@ -45,7 +45,7 @@ public struct CompositeEventSourceBuilder<Event> {
public func build() -> AnyEventSource<Event> {
switch eventSources.count {
case 0:
return AnyEventSource<Event> { _ in AnonymousDisposable {} }
return AnyEventSource { _ in AnonymousDisposable {} }
case 1:
return eventSources[0]
default:
Expand Down
2 changes: 1 addition & 1 deletion MobiusCore/Test/AnyConnectionTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class ConnectionTests: QuickSpec {
beforeEach {
let acceptClosure = { (value: Int) in acceptValue = value }
let disposeClosure = { disposeCalled = true }
connection = Connection<Int>(acceptClosure: acceptClosure, disposeClosure: disposeClosure)
connection = Connection(acceptClosure: acceptClosure, disposeClosure: disposeClosure)
}

afterEach {
Expand Down
2 changes: 1 addition & 1 deletion MobiusCore/Test/EffectHandlers/AnyEffectHandlerTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class AnyEffectHandlerTests: QuickSpec {

sharedExamples("expected AnyEffectHandler behaviour") {
it("invokes send and end") {
let callback = EffectCallback<Event>(
let callback = EffectCallback(
onSend: { receivedEvents.append("e-" + $0) },
onEnd: { receivedEvents.append("end") }
)
Expand Down
2 changes: 1 addition & 1 deletion MobiusCore/Test/EffectHandlers/EffectHandlerTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ class EffectHandlerTests: QuickSpec {
beforeEach {
effectHandler = AnyEffectHandler(handle: handleEffect)
receivedEvents = []
let callback = EffectCallback<Event>(
let callback = EffectCallback(
onSend: { event in
receivedEvents.append(event)
},
Expand Down
4 changes: 2 additions & 2 deletions MobiusCore/Test/EffectHandlers/EffectRouterTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ class EffectRouterTests: QuickSpec {
context("Router Disposing on Deinit") {
it("should dispose active `EffectHandler`s when deinitializing") {
var wasDisposed = false
var connection: Connection<Effect>? = EffectRouter<Effect, Event>()
var connection: Connection? = EffectRouter<Effect, Event>()
.routeEffects(equalTo: .effect1)
.to { _, _ in
return AnonymousDisposable {
Expand All @@ -214,7 +214,7 @@ private class TestConnectable: Connectable {
self.onDispose = onDispose
}
func connect(_ consumer: @escaping (Event) -> Void) -> Connection<Effect> {
Connection<Effect>(
Connection(
acceptClosure: { _ in consumer(self.event) },
disposeClosure: onDispose
)
Expand Down
2 changes: 1 addition & 1 deletion MobiusCore/Test/FirstTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class FirstTests: QuickSpec {

describe("public initializer") {
beforeEach {
sut = First<String, Effect>(model: "a", effects: [.send])
sut = First(model: "a", effects: [.send])
}

it("should set the model property") {
Expand Down
4 changes: 2 additions & 2 deletions MobiusCore/Test/MobiusLoopTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -148,8 +148,8 @@ class MobiusLoopTests: QuickSpec {
update: Update { _, _ in .noChange },
publisher: ConnectablePublisher()
)
modelPublisher = ConnectablePublisher<String>()
disposable = ConnectablePublisher<String>()
modelPublisher = ConnectablePublisher()
disposable = ConnectablePublisher()

loop = MobiusLoop(
eventProcessor: eventProcessor,
Expand Down
4 changes: 2 additions & 2 deletions MobiusCore/Test/TestingUtil.swift
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ class SimpleTestConnectable: Connectable {
var disposed = false

func connect(_ consumer: @escaping (String) -> Void) -> Connection<String> {
return Connection<String>(acceptClosure: { _ in }, disposeClosure: { [weak self] in self?.disposed = true })
return Connection(acceptClosure: { _ in }, disposeClosure: { [weak self] in self?.disposed = true })
}
}

Expand All @@ -58,7 +58,7 @@ class RecordingTestConnectable: Connectable {
private let expectedQueue: DispatchQueue?

init(expectedQueue: DispatchQueue? = nil) {
recorder = Recorder<String>()
recorder = Recorder()
self.expectedQueue = expectedQueue
}

Expand Down
2 changes: 1 addition & 1 deletion MobiusExtras/Source/ConnectableContramap.swift
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public extension Connectable {
)
}

let contramapped = AnyConnectable<NewInput, Output>(newConnectClosure)
let contramapped = AnyConnectable(newConnectClosure)

return contramapped
}
Expand Down
2 changes: 1 addition & 1 deletion MobiusExtras/Test/ConnectableContramapTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ class ConnectableContramapTests: QuickSpec {
}

beforeEach {
connectable = AnyConnectable<String, String>({ (consumer: @escaping Consumer<String>) -> Connection<String> in
connectable = AnyConnectable({ (consumer: @escaping Consumer<String>) -> Connection<String> in
Connection(acceptClosure: consumer, disposeClosure: dispose)
})

Expand Down
2 changes: 1 addition & 1 deletion MobiusNimble/Test/NimbleFirstMatchersTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ class NimbleFirstMatchersTests: QuickSpec {

let model = "3"
func testInitiate(model: String) -> First<String, String> {
return First<String, String>(model: model, effects: ["2", "4"])
return First(model: model, effects: ["2", "4"])
}

// Testing through proxy: UpdateSpec
Expand Down
2 changes: 1 addition & 1 deletion MobiusNimble/Test/NimbleNextMatchersTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ class NimbleNextMatchersTests: QuickSpec {
// Testing through proxy: UpdateSpec
context("when asserting through predicates that fail") {
beforeEach {
UpdateSpec<String, String, String>(testUpdate)
UpdateSpec(testUpdate)
.given("a model")
.when("")
.then(assertThatNext(haveNoModel(), haveNoEffects()))
Expand Down
2 changes: 1 addition & 1 deletion MobiusTest/Test/FirstMatchersTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class FirstMatchersTests: QuickSpec {
let model = "3"

func testInitiate(model: String) -> First<String, String> {
return First<String, String>(model: model, effects: ["2", "4"])
return First(model: model, effects: ["2", "4"])
}

func failureDetector(message: String, file: StaticString, line: UInt) {
Expand Down
2 changes: 1 addition & 1 deletion MobiusTest/Test/InitSpecTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class InitSpecTests: QuickSpec {
testModel = UUID().uuidString
testEffects = ["1", "2", "3"]
initiate = { (model: String) in
First<String, String>(model: model + model, effects: testEffects)
First(model: model + model, effects: testEffects)
}

spec = InitSpec(initiate)
Expand Down
2 changes: 1 addition & 1 deletion MobiusTest/Test/NextMatchersTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ class XCTestNextMatchersTests: QuickSpec {
// Testing through proxy: UpdateSpec
context("when asserting through predicates that fail") {
beforeEach {
UpdateSpec<String, String, String>(testUpdate)
UpdateSpec(testUpdate)
.given("a model")
.when("")
.then(assertThatNext(
Expand Down
2 changes: 1 addition & 1 deletion MobiusTest/Test/UpdateSpecTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ enum MyEffect {
class UpdateSpecTests: QuickSpec {
// swiftlint:disable function_body_length
override func spec() {
let updateSpec = UpdateSpec<MyModel, MyEvent, MyEffect>(myUpdate)
let updateSpec = UpdateSpec(myUpdate)

describe("UpdateSpec") {
describe("single events") {
Expand Down