@@ -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
5757UnsafeMutableRawPointerExtraTestSuite . 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
7575UnsafeMutableRawPointerExtraTestSuite . 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
9797UnsafeMutableRawPointerExtraTestSuite . 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