Skip to content

Commit 1d5a2f7

Browse files
committed
formatting fixes
1 parent 57506b4 commit 1d5a2f7

17 files changed

+47
-36
lines changed

Sources/RediStack/ChannelHandlers/RedisCommandHandler.swift

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,9 @@ extension RedisCommandHandler: ChannelInboundHandler {
9191
self.state = .error(error)
9292
let queue = self.commandResponseQueue
9393
self.commandResponseQueue.removeAll()
94-
queue.forEach { $0.fail(error) }
94+
for element in queue {
95+
element.fail(error)
96+
}
9597
}
9698

9799
/// Invoked by SwiftNIO when a read has been fired from earlier in the response chain.

Sources/RediStack/ChannelHandlers/RedisPubSubHandler.swift

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -310,10 +310,12 @@ extension RedisPubSubHandler {
310310

311311
// create them
312312
let pendingSubscriptions: [(String, EventLoopPromise<Int>)] = targets.map {
313-
return (self.prefixKey($0, with: keyPrefix), self.eventLoop.makePromise())
313+
(self.prefixKey($0, with: keyPrefix), self.eventLoop.makePromise())
314314
}
315315
// add the subscription change handler to the appropriate queue for each individual subscription target
316-
pendingSubscriptions.forEach { self[keyPath: pendingQueue].updateValue($1, forKey: $0) }
316+
for (key, value) in pendingSubscriptions {
317+
self[keyPath: pendingQueue].updateValue(value, forKey: key)
318+
}
317319

318320
// synchronize all of the individual subscription changes
319321
let subscriptionCountFuture = EventLoopFuture<Int>
@@ -480,9 +482,9 @@ extension RedisPubSubHandler: ChannelInboundHandler {
480482

481483
let receivers = self.subscriptions
482484
self.subscriptions.removeAll()
483-
receivers.forEach {
484-
$0.value.onUnsubscribe?($0.key, 0)
485-
$0.value.type.gauge.decrement()
485+
for receiver in receivers {
486+
receiver.value.onUnsubscribe?(receiver.key, 0)
487+
receiver.value.type.gauge.decrement()
486488
}
487489
}
488490
}

Sources/RediStack/Cluster/RedisClusterShardDescriptionProtocol.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ public protocol RedisClusterShardDescriptionProtocol: Identifiable, Sendable {
1818
associatedtype NodeDescription: RedisClusterNodeDescriptionProtocol
1919

2020
/// The shard's primary node
21-
var master: NodeDescription { get } // #ignore-unacceptable-language
21+
var master: NodeDescription { get } // #ignore-unacceptable-language
2222

2323
/// The shard's replica nodes
2424
var replicas: [NodeDescription] { get }

Sources/RediStack/Commands/BasicCommands.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,7 @@ extension RedisClient {
251251
}
252252
let elements =
253253
response
254-
.map { return $0[1] }
254+
.map { $0[1] }
255255
.tryConverting(to: resultType)
256256

257257
return position.and(elements)

Sources/RediStack/ConnectionPool/RedisConnectionPool+Configuration.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ extension RedisConnectionPool {
138138
connectionRetryTimeout ?? .milliseconds(10) // always default to a baseline 10ms
139139
)
140140
self.onUnexpectedConnectionClose = onUnexpectedConnectionClose
141-
self.poolDefaultLogger = poolDefaultLogger ?? .redisBaseConnectionPoolLogger
141+
self.poolDefaultLogger = poolDefaultLogger ?? .redisBaseConnectionPool
142142
}
143143
}
144144
}

Sources/RediStack/RESP/RESPTranslator.swift

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,9 @@ extension ByteBuffer {
6868
self.writeStaticString("*")
6969
self.writeString("\(array.count)")
7070
self.writeStaticString(respEnd)
71-
array.forEach { self.writeRESPValue($0) }
71+
for element in array {
72+
self.writeRESPValue(element)
73+
}
7274
}
7375
}
7476
}

Sources/RediStack/RESP/RESPValue.swift

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,9 @@ extension RangeReplaceableCollection where Element == RESPValue {
207207
guard elementsToCopy.count > 0 else { return }
208208

209209
self.reserveCapacity(self.count + elementsToCopy.count)
210-
elementsToCopy.forEach { self.append($0.convertedToRESPValue()) }
210+
for element in elementsToCopy {
211+
self.append(element.convertedToRESPValue())
212+
}
211213
}
212214

213215
/// Adds the elements of a collection to this array, delegating the details of how they are added to the given closure.
@@ -254,7 +256,9 @@ extension RangeReplaceableCollection where Element == RESPValue {
254256
let sizeToAdd = overestimatedCountBeingAdded ?? elementsToCopy.count
255257
self.reserveCapacity(self.count + sizeToAdd)
256258

257-
elementsToCopy.forEach { closure(&self, $0) }
259+
for element in elementsToCopy {
260+
closure(&self, element)
261+
}
258262
}
259263
}
260264

Sources/RediStack/RedisClient.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,7 @@ public struct RedisClientError: LocalizedError, Equatable, Hashable {
267267

268268
private init(_ baseError: BaseError) { self.baseError = baseError }
269269

270-
/* Protocol Conformances and Private Type implementation */
270+
// Protocol Conformances and Private Type implementation
271271

272272
public static func == (lhs: RedisClientError, rhs: RedisClientError) -> Bool {
273273
lhs.localizedDescription == rhs.localizedDescription

Sources/RediStack/RedisConnection+Configuration.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ extension RedisConnection {
4343
}
4444
}
4545

46-
internal static let defaultLogger = Logger.redisBaseConnectionLogger
46+
internal static let defaultLogger = Logger.redisBaseConnection
4747

4848
/// The hostname of the connection address. If the address is a Unix socket, then it will be `nil`.
4949
public var hostname: String? {

Sources/RediStack/RedisLogging.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,9 @@ public enum RedisLogging {
6060

6161
extension Logger {
6262
/// The prototypical instance used for Redis connections.
63-
public static var redisBaseConnectionLogger: Logger { RedisLogging.baseConnectionLogger }
63+
public static var redisBaseConnection: Logger { RedisLogging.baseConnectionLogger }
6464
/// The prototypical instance used for Redis connection pools.
65-
public static var redisBaseConnectionPoolLogger: Logger { RedisLogging.baseConnectionPoolLogger }
65+
public static var redisBaseConnectionPool: Logger { RedisLogging.baseConnectionPoolLogger }
6666
}
6767

6868
// MARK: Protocol-based Context Passing

0 commit comments

Comments
 (0)