Skip to content

Commit 187f0f1

Browse files
authored
Merge pull request #492 from erwald/fix-swiftlint-violations
Fix (some) SwiftLint violations
2 parents 6147571 + 83b921a commit 187f0f1

17 files changed

+667
-663
lines changed

.swiftlint.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
disabled_rules:
2+
- opening_brace
3+
included:
4+
- Sources
5+
- Tests
6+
7+
trailing_comma:
8+
mandatory_comma: true
9+
10+
line_length: 200

Sources/Atomic.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,7 @@ public final class Atomic<Value> {
256256

257257
return try action(&_value)
258258
}
259-
259+
260260
/// Atomically perform an arbitrary action using the current value of the
261261
/// variable.
262262
///

Sources/Disposable.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ public final class CompositeDisposable: Disposable {
124124
self.disposables = Atomic(bag)
125125
self.state = UnsafeAtomicState(DisposableState.active)
126126
}
127-
127+
128128
/// Initialize a `CompositeDisposable` containing the given sequence of
129129
/// disposables.
130130
///
@@ -231,7 +231,7 @@ public final class CompositeDisposable: Disposable {
231231
/// - returns: An instance of `DisposableHandle` that can be used to opaquely
232232
/// remove the disposable later (if desired).
233233
@discardableResult
234-
public static func +=(lhs: CompositeDisposable, rhs: @escaping () -> ()) -> Disposable? {
234+
public static func +=(lhs: CompositeDisposable, rhs: @escaping () -> Void) -> Disposable? {
235235
return lhs.add(rhs)
236236
}
237237
}
@@ -310,7 +310,7 @@ extension ScopedDisposable where Inner == CompositeDisposable {
310310
/// - returns: An instance of `DisposableHandle` that can be used to opaquely
311311
/// remove the disposable later (if desired).
312312
@discardableResult
313-
public static func +=(lhs: ScopedDisposable<CompositeDisposable>, rhs: @escaping () -> ()) -> Disposable? {
313+
public static func +=(lhs: ScopedDisposable<CompositeDisposable>, rhs: @escaping () -> Void) -> Disposable? {
314314
return lhs.inner.add(rhs)
315315
}
316316
}

Sources/Flatten.swift

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -393,7 +393,7 @@ extension SignalProducer {
393393
public func concat(_ next: SignalProducer<Value, Error>) -> SignalProducer<Value, Error> {
394394
return SignalProducer<SignalProducer<Value, Error>, Error>([ self.producer, next ]).flatten(.concat)
395395
}
396-
396+
397397
/// `concat`s `value` onto `self`.
398398
///
399399
/// - parameters:
@@ -404,7 +404,7 @@ extension SignalProducer {
404404
public func concat(value: Value) -> SignalProducer<Value, Error> {
405405
return self.concat(SignalProducer(value: value))
406406
}
407-
407+
408408
/// `concat`s `self` onto initial `previous`.
409409
///
410410
/// - parameters:
@@ -415,7 +415,7 @@ extension SignalProducer {
415415
public func prefix(_ previous: SignalProducer<Value, Error>) -> SignalProducer<Value, Error> {
416416
return previous.concat(self)
417417
}
418-
418+
419419
/// `concat`s `self` onto initial `value`.
420420
///
421421
/// - parameters:
@@ -433,10 +433,10 @@ private final class ConcurrentFlattenState<Value, Error: Swift.Error> {
433433

434434
/// The limit of active producers.
435435
let limit: UInt
436-
436+
437437
/// The number of active producers.
438438
var activeCount: UInt = 0
439-
439+
440440
/// The producers waiting to be started.
441441
var queue: [Producer] = []
442442

@@ -451,7 +451,7 @@ private final class ConcurrentFlattenState<Value, Error: Swift.Error> {
451451
init(limit: UInt) {
452452
self.limit = limit
453453
}
454-
454+
455455
/// Dequeue the next producer if one should be started.
456456
///
457457
/// - returns: The `Producer` to start or `nil` if no producer should be
@@ -489,7 +489,7 @@ extension Signal {
489489
.flatten(.merge)
490490
.startAndRetrieveSignal()
491491
}
492-
492+
493493
/// Merges the given signals into a single `Signal` that will emit all
494494
/// values from each of them, and complete when all of them have completed.
495495
///
@@ -511,7 +511,7 @@ extension SignalProducer {
511511
{
512512
return SignalProducer<Seq.Iterator.Element, NoError>(producers).flatten(.merge)
513513
}
514-
514+
515515
/// Merges the given producers into a single `SignalProducer` that will emit
516516
/// all values from each of them, and complete when all of them have
517517
/// completed.
@@ -645,7 +645,7 @@ extension SignalProducer where Value: SignalProducerConvertible, Error == Value.
645645
private struct LatestState<Value, Error: Swift.Error> {
646646
var outerSignalComplete: Bool = false
647647
var innerSignalComplete: Bool = true
648-
648+
649649
var replacingInnerSignal: Bool = false
650650
}
651651

@@ -790,7 +790,7 @@ extension Signal {
790790
public func flatMap<Inner: SignalProducerConvertible>(_ strategy: FlattenStrategy, _ transform: @escaping (Value) -> Inner) -> Signal<Inner.Value, Error> where Inner.Error == Error {
791791
return map(transform).flatten(strategy)
792792
}
793-
793+
794794
/// Maps each event from `signal` to a new signal, then flattens the
795795
/// resulting producers (into a signal of values), according to the
796796
/// semantics of the given strategy.
@@ -822,7 +822,7 @@ extension Signal where Error == NoError {
822822
public func flatMap<Inner: SignalProducerConvertible>(_ strategy: FlattenStrategy, _ transform: @escaping (Value) -> Inner) -> Signal<Inner.Value, Inner.Error> {
823823
return map(transform).flatten(strategy)
824824
}
825-
825+
826826
/// Maps each event from `signal` to a new signal, then flattens the
827827
/// resulting signals (into a signal of values), according to the
828828
/// semantics of the given strategy.
@@ -851,7 +851,7 @@ extension SignalProducer {
851851
public func flatMap<Inner: SignalProducerConvertible>(_ strategy: FlattenStrategy, _ transform: @escaping (Value) -> Inner) -> SignalProducer<Inner.Value, Error> where Inner.Error == Error {
852852
return map(transform).flatten(strategy)
853853
}
854-
854+
855855
/// Maps each event from `self` to a new producer, then flattens the
856856
/// resulting producers (into a producer of values), according to the
857857
/// semantics of the given strategy.
@@ -880,7 +880,7 @@ extension SignalProducer where Error == NoError {
880880
public func flatMap<Inner: SignalProducerConvertible>(_ strategy: FlattenStrategy, _ transform: @escaping (Value) -> Inner) -> SignalProducer<Inner.Value, Error> where Inner.Error == Error {
881881
return map(transform).flatten(strategy)
882882
}
883-
883+
884884
/// Maps each event from `self` to a new producer, then flattens the
885885
/// resulting producers (into a producer of values), according to the
886886
/// semantics of the given strategy.
@@ -897,7 +897,6 @@ extension SignalProducer where Error == NoError {
897897
}
898898
}
899899

900-
901900
extension Signal {
902901
/// Catches any failure that may occur on the input signal, mapping to a new
903902
/// producer that starts in its place.

Sources/Property.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -375,7 +375,7 @@ extension PropertyProtocol where Value == Bool {
375375
public func negate() -> Property<Value> {
376376
return self.lift { $0.negate() }
377377
}
378-
378+
379379
/// Create a property that computes a logical AND between the latest values of `self`
380380
/// and `property`.
381381
///
@@ -386,7 +386,7 @@ extension PropertyProtocol where Value == Bool {
386386
public func and<P: PropertyProtocol>(_ property: P) -> Property<Value> where P.Value == Value {
387387
return self.lift(SignalProducer.and)(property)
388388
}
389-
389+
390390
/// Create a property that computes a logical OR between the latest values of `self`
391391
/// and `property`.
392392
///

Sources/Scheduler.swift

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -192,11 +192,11 @@ public final class QueueScheduler: DateScheduler {
192192
}
193193

194194
public let queue: DispatchQueue
195-
195+
196196
internal init(internalQueue: DispatchQueue) {
197197
queue = internalQueue
198198
}
199-
199+
200200
/// Initializes a scheduler that will target the given queue with its
201201
/// work.
202202
///
@@ -544,20 +544,20 @@ public final class TestScheduler: DateScheduler {
544544
public func run() {
545545
advance(to: Date.distantFuture)
546546
}
547-
547+
548548
/// Rewinds the virtualized clock by the given interval.
549549
/// This simulates that user changes device date.
550550
///
551551
/// - parameters:
552552
/// - interval: An interval by which the current date will be retreated.
553553
public func rewind(by interval: DispatchTimeInterval) {
554554
lock.lock()
555-
555+
556556
let newDate = currentDate.addingTimeInterval(-interval)
557557
assert(currentDate.compare(newDate) != .orderedAscending)
558558
_currentDate = newDate
559-
559+
560560
lock.unlock()
561-
561+
562562
}
563563
}

0 commit comments

Comments
 (0)