Skip to content

Commit 93d65fc

Browse files
committed
[gardening] Remove trailing whitespace
1 parent f52a865 commit 93d65fc

File tree

4 files changed

+53
-53
lines changed

4 files changed

+53
-53
lines changed

stdlib/public/core/StringBridge.swift

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -173,17 +173,17 @@ internal enum _KnownCocoaString {
173173
#if !(arch(i386) || arch(arm))
174174
case tagged
175175
#endif
176-
176+
177177
@inline(__always)
178178
init(_ str: _CocoaString) {
179-
179+
180180
#if !(arch(i386) || arch(arm))
181181
if _isObjCTaggedPointer(str) {
182182
self = .tagged
183183
return
184184
}
185185
#endif
186-
186+
187187
switch unsafeBitCast(_swift_classOfObjCHeapObject(str), to: UInt.self) {
188188
case unsafeBitCast(__StringStorage.self, to: UInt.self):
189189
self = .storage
@@ -272,21 +272,21 @@ internal func _bridgeCocoaString(_ cocoaString: _CocoaString) -> _StringGuts {
272272
// 3) If it's mutable with associated information, must make the call
273273
let immutableCopy
274274
= _stdlib_binary_CFStringCreateCopy(cocoaString) as AnyObject
275-
275+
276276
#if !(arch(i386) || arch(arm))
277277
if _isObjCTaggedPointer(immutableCopy) {
278278
return _StringGuts(_SmallString(taggedCocoa: immutableCopy))
279279
}
280280
#endif
281-
281+
282282
let (fastUTF8, isASCII): (Bool, Bool)
283283
switch _getCocoaStringPointer(immutableCopy) {
284284
case .ascii(_): (fastUTF8, isASCII) = (true, true)
285285
case .utf8(_): (fastUTF8, isASCII) = (true, false)
286286
default: (fastUTF8, isASCII) = (false, false)
287287
}
288288
let length = _stdlib_binary_CFStringGetLength(immutableCopy)
289-
289+
290290
return _StringGuts(
291291
cocoa: immutableCopy,
292292
providesFastUTF8: fastUTF8,

stdlib/public/core/StringStorage.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -141,9 +141,9 @@ extension _AbstractStringStorage {
141141
// one of ours.
142142

143143
defer { _fixLifetime(other) }
144-
144+
145145
let otherUTF16Length = _stdlib_binary_CFStringGetLength(other)
146-
146+
147147
// CFString will only give us ASCII bytes here, but that's fine.
148148
// We already handled non-ASCII UTF8 strings earlier since they're Swift.
149149
if let otherStart = _cocoaUTF8Pointer(other) {
@@ -154,11 +154,11 @@ extension _AbstractStringStorage {
154154
return (start == otherStart ||
155155
(memcmp(start, otherStart, count) == 0)) ? 1 : 0
156156
}
157-
157+
158158
if UTF16Length != otherUTF16Length {
159159
return 0
160160
}
161-
161+
162162
/*
163163
The abstract implementation of -isEqualToString: falls back to -compare:
164164
immediately, so when we run out of fast options to try, do the same.

stdlib/public/core/UTF8.swift

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ extension Unicode.UTF8 : _UnicodeEncoding {
9999
return Unicode.Scalar(_unchecked: value)
100100
}
101101
}
102-
102+
103103
@inline(__always)
104104
@inlinable
105105
public static func encode(
@@ -136,7 +136,7 @@ extension Unicode.UTF8 : _UnicodeEncoding {
136136
) -> EncodedScalar? {
137137
if _fastPath(FromEncoding.self == UTF16.self) {
138138
let c = _identityCast(content, to: UTF16.EncodedScalar.self)
139-
var u0 = UInt16(truncatingIfNeeded: c._storage)
139+
var u0 = UInt16(truncatingIfNeeded: c._storage)
140140
if _fastPath(u0 < 0x80) {
141141
return EncodedScalar(_containing: UInt8(truncatingIfNeeded: u0))
142142
}
@@ -169,7 +169,7 @@ extension Unicode.UTF8 : _UnicodeEncoding {
169169
public init() { _buffer = _Buffer() }
170170
public var _buffer: _Buffer
171171
}
172-
172+
173173
@frozen
174174
public struct ReverseParser {
175175
public typealias _Buffer = _UIntBuffer<UInt8>
@@ -246,7 +246,7 @@ extension UTF8.ReverseParser : Unicode.Parser, _UTFParser {
246246
}
247247
return 1
248248
}
249-
249+
250250
@inline(__always)
251251
@inlinable
252252
public func _bufferedScalar(bitCount: UInt8) -> Encoding.EncodedScalar {
@@ -263,7 +263,7 @@ extension Unicode.UTF8.ForwardParser : Unicode.Parser, _UTFParser {
263263
@inlinable
264264
public func _parseMultipleCodeUnits() -> (isValid: Bool, bitCount: UInt8) {
265265
_internalInvariant(_buffer._storage & 0x80 != 0) // this case handled elsewhere
266-
266+
267267
if _buffer._storage & 0b0__1100_0000__1110_0000
268268
== 0b0__1000_0000__1100_0000 {
269269
// 2-byte sequence. At least one of the top 4 bits of the decoded result
@@ -317,7 +317,7 @@ extension Unicode.UTF8.ForwardParser : Unicode.Parser, _UTFParser {
317317
}
318318
return 1
319319
}
320-
320+
321321
@inlinable
322322
public func _bufferedScalar(bitCount: UInt8) -> Encoding.EncodedScalar {
323323
let x = UInt32(_buffer._storage) &+ 0x01010101

validation-test/stdlib/String.swift

Lines changed: 37 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -601,11 +601,11 @@ StringTests.test("appendToSubstringBug")
601601
if s0.unusedCapacity == 0 { s0 += "y" }
602602
let cap = s0.unusedCapacity
603603
expectNotEqual(0, cap)
604-
604+
605605
// This sorta checks for the original bug
606606
expectEqual(
607607
cap, String(s0[s0.index(_nth: 1)..<s0.endIndex]).unusedCapacity)
608-
608+
609609
return (s0, cap)
610610
}
611611

@@ -615,7 +615,7 @@ StringTests.test("appendToSubstringBug")
615615
return (String(s0[s0.index(_nth: 5)..<s0.endIndex]), unused)
616616
}()
617617
let originalID = s.bufferID
618-
// Appending to a String always results in storage that
618+
// Appending to a String always results in storage that
619619
// starts at the beginning of its native buffer
620620
s += "z"
621621
expectNotEqual(originalID, s.bufferID)
@@ -879,15 +879,15 @@ StringTests.test("stringGutsExtensibility")
879879
for k in 0..<3 {
880880
for count in 1..<16 {
881881
for boundary in 0..<count {
882-
882+
883883
var x = (
884884
k == 0 ? asciiString("b")
885885
: k == 1 ? ("b" as NSString as String)
886886
: ("b" as NSMutableString as String)
887887
)
888888

889889
if k == 0 { expectTrue(x._guts.isFastUTF8) }
890-
890+
891891
for i in 0..<count {
892892
x.append(String(
893893
decoding: repeatElement(i < boundary ? ascii : nonAscii, count: 3),
@@ -896,7 +896,7 @@ StringTests.test("stringGutsExtensibility")
896896
// Make sure we can append pure ASCII to wide storage
897897
x.append(String(
898898
decoding: repeatElement(ascii, count: 2), as: UTF16.self))
899-
899+
900900
expectEqualSequence(
901901
[UTF16.CodeUnit(UnicodeScalar("b").value)]
902902
+ Array(repeatElement(ascii, count: 3*boundary))
@@ -950,17 +950,17 @@ StringTests.test("stringGutsReserve")
950950
fatalError("case unhandled!")
951951
}
952952
expectEqual(isSwiftNative(base), startedNative)
953-
953+
954954
let originalBuffer = base.bufferID
955955
let isUnique = base._guts.isUniqueNative
956956
let startedUnique =
957957
startedNative &&
958958
base._classify()._objectIdentifier != nil &&
959959
isUnique
960-
960+
961961
base.reserveCapacity(16)
962962
// Now it's unique
963-
963+
964964
// If it was already native and unique, no reallocation
965965
if startedUnique && startedNative {
966966
expectEqual(originalBuffer, base.bufferID)
@@ -1301,22 +1301,22 @@ StringTests.test("unicodeViews") {
13011301
// FIXME: note changed String(describing:) results
13021302
expectEqual(
13031303
"\u{FFFD}",
1304-
String(describing:
1304+
String(describing:
13051305
winter.utf8[
13061306
winter.utf8.startIndex
13071307
..<
13081308
winter.utf8.index(after: winter.utf8.index(after: winter.utf8.startIndex))
13091309
]))
13101310
*/
1311-
1311+
13121312
expectEqual(
13131313
"\u{1F3C2}", String(
13141314
winter.utf8[winter.utf8.startIndex..<winter.utf8.index(_nth: 4)]))
13151315

13161316
expectEqual(
13171317
"\u{1F3C2}", String(
13181318
winter.utf16[winter.utf16.startIndex..<winter.utf16.index(_nth: 2)]))
1319-
1319+
13201320
expectEqual(
13211321
"\u{1F3C2}", String(
13221322
winter.unicodeScalars[
@@ -1357,7 +1357,7 @@ StringTests.test("indexConversion")
13571357
let s = "go further into the larder to barter."
13581358

13591359
var matches: [String] = []
1360-
1360+
13611361
re.enumerateMatches(
13621362
in: s, options: NSRegularExpression.MatchingOptions(), range: NSRange(0..<s.utf16.count)
13631363
) {
@@ -1811,18 +1811,18 @@ public let testSuffix = "z"
18111811
StringTests.test("COW.Smoke") {
18121812
var s1 = "COW Smoke Cypseloides" + testSuffix
18131813
let identity1 = s1._rawIdentifier()
1814-
1814+
18151815
var s2 = s1
18161816
expectEqual(identity1, s2._rawIdentifier())
1817-
1817+
18181818
s2.append(" cryptus")
18191819
expectTrue(identity1 != s2._rawIdentifier())
1820-
1820+
18211821
s1.remove(at: s1.startIndex)
18221822
expectEqual(identity1, s1._rawIdentifier())
1823-
1823+
18241824
_fixLifetime(s1)
1825-
_fixLifetime(s2)
1825+
_fixLifetime(s2)
18261826
}
18271827

18281828
struct COWStringTest {
@@ -1840,17 +1840,17 @@ for test in testCases {
18401840
StringTests.test("COW.\(test.name).IndexesDontAffectUniquenessCheck") {
18411841
let s = test.test + testSuffix
18421842
let identity1 = s._rawIdentifier()
1843-
1843+
18441844
let startIndex = s.startIndex
18451845
let endIndex = s.endIndex
18461846
expectNotEqual(startIndex, endIndex)
18471847
expectLT(startIndex, endIndex)
18481848
expectLE(startIndex, endIndex)
18491849
expectGT(endIndex, startIndex)
18501850
expectGE(endIndex, startIndex)
1851-
1851+
18521852
expectEqual(identity1, s._rawIdentifier())
1853-
1853+
18541854
// Keep indexes alive during the calls above
18551855
_fixLifetime(startIndex)
18561856
_fixLifetime(endIndex)
@@ -1972,7 +1972,7 @@ for test in testCases {
19721972

19731973
expectGT(s.count, 0)
19741974
expectEqual(identity1, s._rawIdentifier())
1975-
}
1975+
}
19761976
}
19771977

19781978
for test in testCases {
@@ -2027,16 +2027,16 @@ enum _Ordering: Int, Equatable {
20272027
}
20282028
}
20292029

2030-
struct ComparisonTestCase {
2030+
struct ComparisonTestCase {
20312031
var strings: [String]
20322032
// var test: (String, String) -> Void
20332033
var comparison: _Ordering
2034-
2034+
20352035
init(_ strings: [String], _ comparison: _Ordering) {
20362036
self.strings = strings
20372037
self.comparison = comparison
20382038
}
2039-
2039+
20402040
func test() {
20412041
for pair in zip(strings, strings[1...]) {
20422042
switch comparison {
@@ -2063,7 +2063,7 @@ struct ComparisonTestCase {
20632063
}
20642064
}
20652065
}
2066-
2066+
20672067
func testOpaqueStrings() {
20682068
#if _runtime(_ObjC)
20692069
let opaqueStrings = strings.map { NSSlowString(string: $0) as String }
@@ -2080,16 +2080,16 @@ struct ComparisonTestCase {
20802080
expectEqualSequence(strings, opaqueStrings)
20812081
#endif
20822082
}
2083-
2083+
20842084
func testOpaqueSubstrings() {
20852085
#if _runtime(_ObjC)
20862086
for pair in zip(strings, strings[1...]) {
20872087
let string1 = pair.0.dropLast()
20882088
let string2 = pair.1
20892089
let opaqueString = (NSSlowString(string: pair.0) as String).dropLast()
2090-
2090+
20912091
guard string1.count > 0 else { return }
2092-
2092+
20932093
expectEqual(string1, opaqueString)
20942094
expectEqual(string1 < string2, opaqueString < string2)
20952095
expectEqual(string1 > string2, opaqueString > string2)
@@ -2109,7 +2109,7 @@ let comparisonTestCases = [
21092109

21102110
ComparisonTestCase(["á", "\u{0061}\u{0301}"], .equal),
21112111
ComparisonTestCase(["à", "\u{0061}\u{0301}", "â", "\u{e3}", "a\u{0308}"], .less),
2112-
2112+
21132113
// Exploding scalars AND exploding segments
21142114
ComparisonTestCase(["\u{fa2}", "\u{fa1}\u{fb7}"], .equal),
21152115
ComparisonTestCase([
@@ -2142,15 +2142,15 @@ let comparisonTestCases = [
21422142
"🧀" // D83E DDC0 -- aka a really big scalar
21432143
], .less),
21442144

2145-
2145+
21462146
ComparisonTestCase(["f̛̗̘̙̜̹̺̻̼͇͈͉͍͎̽̾̿̀́͂̓̈́͆͊͋͌̚ͅ͏͓͔͕͖͙͚͐͑͒͗͛ͣͤͥͦ͘͜͟͢͝͞͠͡", "ơ̗̘̙̜̹̺̻̼͇͈͉͍͎̽̾̿̀́͂̓̈́͆͊͋͌̚ͅ͏͓͔͕͖͙͚͐͑͒͗͛ͥͦͧͨͩͪͫͬͭͮ͘"], .less),
21472147
ComparisonTestCase(["\u{f90b}", "\u{5587}"], .equal),
2148-
2148+
21492149
ComparisonTestCase(["a\u{1D160}a", "a\u{1D158}\u{1D1C7}"], .less),
21502150

21512151
ComparisonTestCase(["a\u{305}\u{315}", "a\u{315}\u{305}"], .equal),
21522152
ComparisonTestCase(["a\u{315}bz", "a\u{315}\u{305}az"], .greater),
2153-
2153+
21542154
ComparisonTestCase(["\u{212b}", "\u{00c5}"], .equal),
21552155
ComparisonTestCase([
21562156
"A",
@@ -2180,7 +2180,7 @@ let comparisonTestCases = [
21802180
"\u{FFEE}", // half width CJK dot
21812181
"🧀", // D83E DDC0 -- aka a really big scalar
21822182
], .less),
2183-
2183+
21842184
ComparisonTestCase(["ư̴̵̶̷̸̗̘̙̜̹̺̻̼͇͈͉͍͎̽̾̿̀́͂̓̈́͆͊͋͌̚ͅ͏͓͔͕͖͙͚͐͑͒͗͛ͣͤͥͦͧͨͩͪͫͬͭͮ͘͜͟͢͝͞͠͡", "ì̡̢̧̨̝̞̟̠̣̤̥̦̩̪̫̬̭̮̯̰̹̺̻̼͇͈͉͍͎́̂̃̄̉̊̋̌̍̎̏̐̑̒̓̽̾̿̀́͂̓̈́͆͊͋͌ͅ͏͓͔͕͖͙͐͑͒͗ͬͭͮ͘"], .greater),
21852185
ComparisonTestCase(["ư̴̵̶̷̸̗̘̙̜̹̺̻̼͇͈͉͍͎̽̾̿̀́͂̓̈́͆͊͋͌̚ͅ͏͓͔͕͖͙͚͐͑͒͗͛ͣͤͥͦͧͨͩͪͫͬͭͮ͘͜͟͢͝͞͠͡", "aì̡̢̧̨̝̞̟̠̣̤̥̦̩̪̫̬̭̮̯̰̹̺̻̼͇͈͉͍͎́̂̃̄̉̊̋̌̍̎̏̐̑̒̓̽̾̿̀́͂̓̈́͆͊͋͌ͅ͏͓͔͕͖͙͐͑͒͗ͬͭͮ͘"], .greater),
21862186
ComparisonTestCase(["ì̡̢̧̨̝̞̟̠̣̤̥̦̩̪̫̬̭̮̯̰̹̺̻̼͇͈͉͍͎́̂̃̄̉̊̋̌̍̎̏̐̑̒̓̽̾̿̀́͂̓̈́͆͊͋͌ͅ͏͓͔͕͖͙͐͑͒͗ͬͭͮ͘", "ì̡̢̧̨̝̞̟̠̣̤̥̦̩̪̫̬̭̮̯̰̹̺̻̼͇͈͉͍͎́̂̃̄̉̊̋̌̍̎̏̐̑̒̓̽̾̿̀́͂̓̈́͆͊͋͌ͅ͏͓͔͕͖͙͐͑͒͗ͬͭͮ͘"], .equal)
@@ -2208,7 +2208,7 @@ StringTests.test("Comparison.Substrings") {
22082208
let str = "abcdefg"
22092209
let expectedStr = "bcdef"
22102210
let substring = str.dropFirst().dropLast()
2211-
2211+
22122212
expectEqual(expectedStr, substring)
22132213
}
22142214

@@ -2219,15 +2219,15 @@ StringTests.test("Comparison.Substrings/Opaque")
22192219
let str = NSSlowString(string: "abcdefg") as String
22202220
let expectedStr = NSSlowString(string: "bcdef") as String
22212221
let substring = str.dropFirst().dropLast()
2222-
2222+
22232223
expectEqual(expectedStr, substring)
22242224
#endif
22252225
}
22262226

22272227
StringTests.test("NormalizationBufferCrashRegressionTest") {
22282228
let str = "\u{0336}\u{0344}\u{0357}\u{0343}\u{0314}\u{0351}\u{0340}\u{0300}\u{0340}\u{0360}\u{0314}\u{0357}\u{0315}\u{0301}\u{0344}a"
22292229
let set = Set([str])
2230-
2230+
22312231
expectTrue(set.contains(str))
22322232
}
22332233

0 commit comments

Comments
 (0)