@@ -373,7 +373,7 @@ extension StructuredFieldValueParser {
373
373
// Unquoted dquote, this is the end of the string.
374
374
endIndex = index
375
375
break loop
376
- case 0x00 ... 0x1F , 0x7F ... :
376
+ case 0x00 ... 0x1F , 0x7F ... :
377
377
// Forbidden bytes in string: string must be VCHAR and SP.
378
378
throw StructuredHeaderError . invalidString
379
379
default :
@@ -388,7 +388,7 @@ extension StructuredFieldValueParser {
388
388
if endIndex == self . underlyingData. endIndex {
389
389
throw StructuredHeaderError . invalidString
390
390
}
391
- let stringSlice = self . underlyingData [ self . underlyingData. startIndex ..< index]
391
+ let stringSlice = self . underlyingData [ self . underlyingData. startIndex..< index]
392
392
self . underlyingData. formIndex ( after: & index)
393
393
self . underlyingData = self . underlyingData [ index... ]
394
394
@@ -449,7 +449,10 @@ extension StructuredFieldValueParser {
449
449
}
450
450
451
451
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
+ )
453
456
454
457
var index = self . underlyingData. startIndex
455
458
loop: while index < self . underlyingData. endIndex {
@@ -461,12 +464,12 @@ extension StructuredFieldValueParser {
461
464
// / "+" / "-" / "." / "^" / "_" / "`" / "|" / "~"
462
465
// / DIGIT / ALPHA
463
466
//
464
- // The following insane case statement covers this. Tokens suck .
467
+ // The following unfortunate case statement covers this. Tokens; not even once .
465
468
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:
470
473
// Good, consume
471
474
self . underlyingData. formIndex ( after: & index)
472
475
default :
@@ -551,7 +554,8 @@ extension RandomAccessCollection where Element == UInt8, SubSequence == Self {
551
554
extension String {
552
555
// This is the slow path, so we never inline this.
553
556
@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 {
555
559
// We assume the string is previously validated, so the escapes are easily removed. See the doc comment for
556
560
// `StrippingStringEscapesCollection` for more details on what we're doing here.
557
561
let unescapedBytes = StrippingStringEscapesCollection ( bytes, escapes: escapes)
@@ -574,7 +578,8 @@ extension String {
574
578
/// Until this issue is fixed (https://bugs.swift.org/browse/SR-13111) we take a different approach: we use
575
579
/// `String.init(unsafeUninitializedCapacity:initializingWith)`. This is an unsafe function, so to reduce the unsafety as much
576
580
/// 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 {
578
583
private var base: BaseCollection
579
584
private var escapes : UInt
580
585
0 commit comments