Skip to content

Commit 1f1f35a

Browse files
Dave Abrahamsmilseman
authored andcommitted
[stdlib] Squash some warnings in a test
1 parent 8aabc03 commit 1f1f35a

File tree

1 file changed

+11
-9
lines changed

1 file changed

+11
-9
lines changed

validation-test/stdlib/String.swift

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -466,7 +466,7 @@ StringTests.test("appendToSubstringBug") {
466466
}
467467

468468
do {
469-
var (s, unused) = { ()->(String, Int) in
469+
var (s, _) = { ()->(String, Int) in
470470
let (s0, unused) = stringWithUnusedCapacity()
471471
return (s0[s0.index(_nth: 5)..<s0.endIndex], unused)
472472
}()
@@ -478,7 +478,7 @@ StringTests.test("appendToSubstringBug") {
478478
}
479479

480480
do {
481-
var (s, unused) = { ()->(Substring, Int) in
481+
var (s, _) = { ()->(Substring, Int) in
482482
let (s0, unused) = stringWithUnusedCapacity()
483483
return (s0[s0.index(_nth: 5)..<s0.endIndex], unused)
484484
}()
@@ -503,6 +503,7 @@ StringTests.test("appendToSubstringBug") {
503503
expectEqual(originalID, s.bufferID)
504504
s += "."
505505
expectNotEqual(originalID, s.bufferID)
506+
unused += 0 // warning suppression
506507
}
507508
}
508509

@@ -640,7 +641,7 @@ StringTests.test("COW/removeSubrange/end") {
640641
StringTests.test("COW/replaceSubrange/end") {
641642
// Check literal-to-heap reallocation.
642643
do {
643-
var str = "12345678"
644+
let str = "12345678"
644645
let literalIdentity = str.bufferID
645646

646647
var slice = str[str.startIndex..<str.index(_nth: 7)]
@@ -772,7 +773,7 @@ StringTests.test("stringCoreReserve")
772773
}
773774
expectEqual(!base._core.hasCocoaBuffer, startedNative)
774775

775-
var originalBuffer = base.bufferID
776+
let originalBuffer = base.bufferID
776777
let startedUnique = startedNative && base._core._owner != nil
777778
&& isKnownUniquelyReferenced(&base._core._owner!)
778779

@@ -975,10 +976,11 @@ StringTests.test("growth") {
975976
var s = ""
976977
var s2 = s
977978

978-
for i in 0..<20 {
979+
for _ in 0..<20 {
979980
s += "x"
980981
s2 = s
981982
}
983+
expectEqual(s2, s)
982984
expectLE(s.nativeCapacity, 34)
983985
}
984986

@@ -988,20 +990,20 @@ StringTests.test("Construction") {
988990

989991
StringTests.test("Conversions") {
990992
do {
991-
var c: Character = "a"
993+
let c: Character = "a"
992994
let x = String(c)
993995
expectTrue(x._core.isASCII)
994996

995-
var s: String = "a"
997+
let s: String = "a"
996998
expectEqual(s, x)
997999
}
9981000

9991001
do {
1000-
var c: Character = "\u{B977}"
1002+
let c: Character = "\u{B977}"
10011003
let x = String(c)
10021004
expectFalse(x._core.isASCII)
10031005

1004-
var s: String = "\u{B977}"
1006+
let s: String = "\u{B977}"
10051007
expectEqual(s, x)
10061008
}
10071009
}

0 commit comments

Comments
 (0)