@@ -373,7 +373,7 @@ extension StructuredFieldValueParser {
373373 // Unquoted dquote, this is the end of the string.
374374 endIndex = index
375375 break loop
376- case 0x00 ... 0x1F , 0x7F ... :
376+ case 0x00 ... 0x1F , 0x7F ... :
377377 // Forbidden bytes in string: string must be VCHAR and SP.
378378 throw StructuredHeaderError . invalidString
379379 default :
@@ -388,7 +388,7 @@ extension StructuredFieldValueParser {
388388 if endIndex == self . underlyingData. endIndex {
389389 throw StructuredHeaderError . invalidString
390390 }
391- let stringSlice = self . underlyingData [ self . underlyingData. startIndex ..< index]
391+ let stringSlice = self . underlyingData [ self . underlyingData. startIndex..< index]
392392 self . underlyingData. formIndex ( after: & index)
393393 self . underlyingData = self . underlyingData [ index... ]
394394
@@ -449,7 +449,10 @@ extension StructuredFieldValueParser {
449449 }
450450
451451 private mutating func _parseAToken( ) throws -> RFC9651 BareItem {
452- assert ( asciiCapitals. contains ( self . underlyingData. first!) || asciiLowercases. contains ( self . underlyingData. first!) || self . underlyingData. first! == asciiAsterisk)
452+ assert (
453+ asciiCapitals. contains ( self . underlyingData. first!) || asciiLowercases. contains ( self . underlyingData. first!)
454+ || self . underlyingData. first! == asciiAsterisk
455+ )
453456
454457 var index = self . underlyingData. startIndex
455458 loop: while index < self . underlyingData. endIndex {
@@ -461,12 +464,12 @@ extension StructuredFieldValueParser {
461464 // / "+" / "-" / "." / "^" / "_" / "`" / "|" / "~"
462465 // / DIGIT / ALPHA
463466 //
464- // The following insane case statement covers this. Tokens suck .
467+ // The following unfortunate case statement covers this. Tokens; not even once .
465468 case asciiExclamationMark, asciiOctothorpe, asciiDollar, asciiPercent,
466- asciiAmpersand, asciiSquote, asciiAsterisk, asciiPlus, asciiDash,
467- asciiPeriod, asciiCaret, asciiUnderscore, asciiBacktick, asciiPipe,
468- asciiTilde, asciiDigits, asciiCapitals, asciiLowercases,
469- asciiColon, asciiSlash:
469+ asciiAmpersand, asciiSquote, asciiAsterisk, asciiPlus, asciiDash,
470+ asciiPeriod, asciiCaret, asciiUnderscore, asciiBacktick, asciiPipe,
471+ asciiTilde, asciiDigits, asciiCapitals, asciiLowercases,
472+ asciiColon, asciiSlash:
470473 // Good, consume
471474 self . underlyingData. formIndex ( after: & index)
472475 default :
@@ -551,7 +554,8 @@ extension RandomAccessCollection where Element == UInt8, SubSequence == Self {
551554extension String {
552555 // This is the slow path, so we never inline this.
553556 @inline ( never)
554- fileprivate static func decodingEscapes< Bytes: RandomAccessCollection > ( _ bytes: Bytes , escapes: Int ) -> String where Bytes. Element == UInt8 {
557+ fileprivate static func decodingEscapes< Bytes: RandomAccessCollection > ( _ bytes: Bytes , escapes: Int ) -> String
558+ where Bytes. Element == UInt8 {
555559 // We assume the string is previously validated, so the escapes are easily removed. See the doc comment for
556560 // `StrippingStringEscapesCollection` for more details on what we're doing here.
557561 let unescapedBytes = StrippingStringEscapesCollection ( bytes, escapes: escapes)
@@ -574,7 +578,8 @@ extension String {
574578/// Until this issue is fixed (https://bugs.swift.org/browse/SR-13111) we take a different approach: we use
575579/// `String.init(unsafeUninitializedCapacity:initializingWith)`. This is an unsafe function, so to reduce the unsafety as much
576580/// as possible we define this safe wrapping Collection and then use `copyBytes` to implement the initialization.
577- private struct StrippingStringEscapesCollection< BaseCollection: Rando mAccessCollection> where BaseCollection. Element == UInt8 {
581+ private struct StrippingStringEscapesCollection< BaseCollection: Rando mAccessCollection>
582+ where BaseCollection. Element == UInt8 {
578583 private var base: BaseCollection
579584 private var escapes : UInt
580585
0 commit comments