@@ -17,7 +17,7 @@ UnsafeMutableRawPointerExtraTestSuite.test("initializeMemory") {
17
17
Missile . missilesLaunched = 0
18
18
do {
19
19
let sizeInBytes = 3 * MemoryLayout< Missile> . stride
20
- var p1 = UnsafeMutableRawPointer . allocate (
20
+ let p1 = UnsafeMutableRawPointer . allocate (
21
21
byteCount: sizeInBytes, alignment: MemoryLayout< Missile> . alignment)
22
22
defer {
23
23
p1. deallocate ( )
@@ -28,7 +28,7 @@ UnsafeMutableRawPointerExtraTestSuite.test("initializeMemory") {
28
28
expectEqual ( 2 , ptrM [ 1 ] . number)
29
29
expectEqual ( 2 , ptrM [ 2 ] . number)
30
30
31
- var p2 = UnsafeMutableRawPointer . allocate (
31
+ let p2 = UnsafeMutableRawPointer . allocate (
32
32
byteCount: sizeInBytes, alignment: MemoryLayout< Missile> . alignment)
33
33
defer {
34
34
p2. deallocate ( )
@@ -56,25 +56,25 @@ UnsafeMutableRawPointerExtraTestSuite.test("initializeMemory") {
56
56
57
57
UnsafeMutableRawPointerExtraTestSuite . test ( " bindMemory " ) {
58
58
let sizeInBytes = 3 * MemoryLayout< Int> . stride
59
- var p1 = UnsafeMutableRawPointer . allocate (
59
+ let p1 = UnsafeMutableRawPointer . allocate (
60
60
byteCount: sizeInBytes, alignment: MemoryLayout< Int> . alignment)
61
61
defer {
62
62
p1. deallocate ( )
63
63
}
64
64
let ptrI = p1. bindMemory ( to: Int . self, capacity: 3 )
65
65
let bufI = UnsafeMutableBufferPointer ( start: ptrI, count: 3 )
66
- bufI. initialize ( from: 1 ... 3 )
66
+ _ = bufI. initialize ( from: 1 ... 3 )
67
67
let ptrU = p1. bindMemory ( to: UInt . self, capacity: 3 )
68
68
expectEqual ( 1 , ptrU [ 0 ] )
69
69
expectEqual ( 2 , ptrU [ 1 ] )
70
70
expectEqual ( 3 , ptrU [ 2 ] )
71
71
let ptrU2 = p1. assumingMemoryBound ( to: UInt . self)
72
- expectEqual ( 1 , ptrU [ 0 ] )
72
+ expectEqual ( 1 , ptrU2 [ 0 ] )
73
73
}
74
74
75
75
UnsafeMutableRawPointerExtraTestSuite . test ( " load/store " ) {
76
76
let sizeInBytes = 3 * MemoryLayout< Int> . stride
77
- var p1 = UnsafeMutableRawPointer . allocate (
77
+ let p1 = UnsafeMutableRawPointer . allocate (
78
78
byteCount: sizeInBytes, alignment: MemoryLayout< Int> . alignment)
79
79
defer {
80
80
p1. deallocate ( )
@@ -96,7 +96,7 @@ UnsafeMutableRawPointerExtraTestSuite.test("load/store") {
96
96
97
97
UnsafeMutableRawPointerExtraTestSuite . test ( " copyMemory " ) {
98
98
let sizeInBytes = 4 * MemoryLayout< Int> . stride
99
- var rawPtr = UnsafeMutableRawPointer . allocate (
99
+ let rawPtr = UnsafeMutableRawPointer . allocate (
100
100
byteCount: sizeInBytes, alignment: MemoryLayout< Int> . alignment)
101
101
defer {
102
102
rawPtr. deallocate ( )
0 commit comments