Skip to content

Commit 98bf5c8

Browse files
authored
Merge pull request #2291 from ikesyo/use-var-binding
Use var binding for switch where appropriate
2 parents ba863a6 + 109efd0 commit 98bf5c8

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

Foundation/IndexPath.swift

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -211,8 +211,7 @@ public struct IndexPath : ReferenceConvertible, Equatable, Hashable, MutableColl
211211
} else {
212212
self = .pair(first, newValue)
213213
}
214-
case .array(let indexes_):
215-
var indexes = indexes_
214+
case .array(var indexes):
216215
indexes[index] = newValue
217216
self = .array(indexes)
218217
}
@@ -429,8 +428,7 @@ public struct IndexPath : ReferenceConvertible, Equatable, Hashable, MutableColl
429428
switch self {
430429
case .empty:
431430
return try body(UnsafeBufferPointer<Int>(start: nil, count: 0))
432-
case .single(let index_):
433-
var index = index_
431+
case .single(var index):
434432
return try withUnsafePointer(to: &index) { (start) throws -> R in
435433
return try body(UnsafeBufferPointer<Int>(start: start, count: 1))
436434
}

0 commit comments

Comments
 (0)