Skip to content

Commit 2eb37a8

Browse files
committed
[gardening] fix warnings in tests
1 parent 2454264 commit 2eb37a8

File tree

2 files changed

+12
-12
lines changed

2 files changed

+12
-12
lines changed

test/stdlib/UnsafePointer.swift.gyb

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ extension UnsafeMutablePointer where Pointee : TestProtocol1 {
2929
}
3030

3131
// Check that the generic parameter is called 'Element'.
32-
extension UnsafeBufferPointerIterator where Element : TestProtocol1 {
32+
extension UnsafeBufferPointer.Iterator where Element : TestProtocol1 {
3333
var _elementIsTestProtocol1: Bool {
3434
fatalError("not implemented")
3535
}
@@ -358,7 +358,7 @@ UnsafeMutablePointerTestSuite.test("initialize:from:.Right") {
358358
}
359359

360360
UnsafeMutablePointerTestSuite.test("initialize:from:/immutable") {
361-
var ptr = UnsafeMutablePointer<Missile>.allocate(capacity: 3)
361+
let ptr = UnsafeMutablePointer<Missile>.allocate(capacity: 3)
362362
defer {
363363
ptr.deinitialize(count: 3)
364364
ptr.deallocate()
@@ -373,7 +373,7 @@ UnsafeMutablePointerTestSuite.test("initialize:from:/immutable") {
373373
}
374374

375375
UnsafeMutablePointerTestSuite.test("assign/immutable") {
376-
var ptr = UnsafeMutablePointer<Missile>.allocate(capacity: 2)
376+
let ptr = UnsafeMutablePointer<Missile>.allocate(capacity: 2)
377377
defer {
378378
ptr.deinitialize(count: 2)
379379
ptr.deallocate()
@@ -463,9 +463,9 @@ ${SelfName}TestSuite.test("withMemoryRebound") {
463463
let ptrI = ${SelfName}<Int>(mutablePtrI)
464464
ptrI.withMemoryRebound(to: UInt.self, capacity: 4) {
465465
// Make sure the closure argument isa $SelfName
466-
var ptrU: ${SelfName}<UInt> = $0
466+
let ptrU: ${SelfName}<UInt> = $0
467467
// and that the element type is UInt.
468-
var mutablePtrU = UnsafeMutablePointer(mutating: ptrU)
468+
let mutablePtrU = UnsafeMutablePointer(mutating: ptrU)
469469
expectType(UInt.self, &mutablePtrU.pointee)
470470
}
471471
}

test/stdlib/UnsafeRawPointer.swift

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ UnsafeMutableRawPointerExtraTestSuite.test("initializeMemory") {
1717
Missile.missilesLaunched = 0
1818
do {
1919
let sizeInBytes = 3 * MemoryLayout<Missile>.stride
20-
var p1 = UnsafeMutableRawPointer.allocate(
20+
let p1 = UnsafeMutableRawPointer.allocate(
2121
byteCount: sizeInBytes, alignment: MemoryLayout<Missile>.alignment)
2222
defer {
2323
p1.deallocate()
@@ -28,7 +28,7 @@ UnsafeMutableRawPointerExtraTestSuite.test("initializeMemory") {
2828
expectEqual(2, ptrM[1].number)
2929
expectEqual(2, ptrM[2].number)
3030

31-
var p2 = UnsafeMutableRawPointer.allocate(
31+
let p2 = UnsafeMutableRawPointer.allocate(
3232
byteCount: sizeInBytes, alignment: MemoryLayout<Missile>.alignment)
3333
defer {
3434
p2.deallocate()
@@ -56,25 +56,25 @@ UnsafeMutableRawPointerExtraTestSuite.test("initializeMemory") {
5656

5757
UnsafeMutableRawPointerExtraTestSuite.test("bindMemory") {
5858
let sizeInBytes = 3 * MemoryLayout<Int>.stride
59-
var p1 = UnsafeMutableRawPointer.allocate(
59+
let p1 = UnsafeMutableRawPointer.allocate(
6060
byteCount: sizeInBytes, alignment: MemoryLayout<Int>.alignment)
6161
defer {
6262
p1.deallocate()
6363
}
6464
let ptrI = p1.bindMemory(to: Int.self, capacity: 3)
6565
let bufI = UnsafeMutableBufferPointer(start: ptrI, count: 3)
66-
bufI.initialize(from: 1...3)
66+
_ = bufI.initialize(from: 1...3)
6767
let ptrU = p1.bindMemory(to: UInt.self, capacity: 3)
6868
expectEqual(1, ptrU[0])
6969
expectEqual(2, ptrU[1])
7070
expectEqual(3, ptrU[2])
7171
let ptrU2 = p1.assumingMemoryBound(to: UInt.self)
72-
expectEqual(1, ptrU[0])
72+
expectEqual(1, ptrU2[0])
7373
}
7474

7575
UnsafeMutableRawPointerExtraTestSuite.test("load/store") {
7676
let sizeInBytes = 3 * MemoryLayout<Int>.stride
77-
var p1 = UnsafeMutableRawPointer.allocate(
77+
let p1 = UnsafeMutableRawPointer.allocate(
7878
byteCount: sizeInBytes, alignment: MemoryLayout<Int>.alignment)
7979
defer {
8080
p1.deallocate()
@@ -96,7 +96,7 @@ UnsafeMutableRawPointerExtraTestSuite.test("load/store") {
9696

9797
UnsafeMutableRawPointerExtraTestSuite.test("copyMemory") {
9898
let sizeInBytes = 4 * MemoryLayout<Int>.stride
99-
var rawPtr = UnsafeMutableRawPointer.allocate(
99+
let rawPtr = UnsafeMutableRawPointer.allocate(
100100
byteCount: sizeInBytes, alignment: MemoryLayout<Int>.alignment)
101101
defer {
102102
rawPtr.deallocate()

0 commit comments

Comments
 (0)