@@ -82,14 +82,11 @@ extension URISerializer {
82
82
/// - Returns: A string describing the serialization error and its associated details.
83
83
var description : String {
84
84
switch self {
85
- case . nestedContainersNotSupported:
86
- " URISerializer: Nested containers are not supported "
87
- case . deepObjectsArrayNotSupported:
88
- " URISerializer: Deep object arrays are not supported "
85
+ case . nestedContainersNotSupported: " URISerializer: Nested containers are not supported "
86
+ case . deepObjectsArrayNotSupported: " URISerializer: Deep object arrays are not supported "
89
87
case . deepObjectsWithPrimitiveValuesNotSupported:
90
88
" URISerializer: Deep object with primitive values are not supported "
91
- case . invalidConfiguration( let string) :
92
- " URISerializer: Invalid configuration: \( string) "
89
+ case . invalidConfiguration( let string) : " URISerializer: Invalid configuration: \( string) "
93
90
}
94
91
}
95
92
@@ -98,9 +95,7 @@ extension URISerializer {
98
95
/// This computed property provides a localized human-readable description of the serialization error, which is suitable for displaying to users.
99
96
///
100
97
/// - Returns: A localized string describing the serialization error.
101
- var errorDescription : String ? {
102
- description
103
- }
98
+ var errorDescription : String ? { description }
104
99
}
105
100
106
101
/// Computes an escaped version of the provided string.
@@ -140,12 +135,10 @@ extension URISerializer {
140
135
guard case let . primitive( primitive) = node else { throw SerializationError . nestedContainersNotSupported }
141
136
return primitive
142
137
}
143
- func unwrapPrimitiveOrArrayOfPrimitives(
144
- _ node: URIEncodedNode
145
- ) throws -> URIEncodedNode . PrimitiveOrArrayOfPrimitives {
146
- if case let . primitive( primitive) = node {
147
- return . primitive( primitive)
148
- }
138
+ func unwrapPrimitiveOrArrayOfPrimitives( _ node: URIEncodedNode ) throws
139
+ -> URIEncodedNode . PrimitiveOrArrayOfPrimitives
140
+ {
141
+ if case let . primitive( primitive) = node { return . primitive( primitive) }
149
142
if case let . array( array) = node {
150
143
let primitives = try array. map ( unwrapPrimitiveValue)
151
144
return . arrayOfPrimitives( primitives)
@@ -292,22 +285,12 @@ extension URISerializer {
292
285
case . primitive( let primitive) :
293
286
try serializePrimitiveKeyValuePair ( primitive, forKey: elementKey, separator: keyAndValueSeparator)
294
287
case . arrayOfPrimitives( let array) :
295
- guard !array. isEmpty else {
296
- return
297
- }
288
+ guard !array. isEmpty else { return }
298
289
for item in array. dropLast ( ) {
299
- try serializePrimitiveKeyValuePair (
300
- item,
301
- forKey: elementKey,
302
- separator: keyAndValueSeparator
303
- )
290
+ try serializePrimitiveKeyValuePair ( item, forKey: elementKey, separator: keyAndValueSeparator)
304
291
data. append ( pairSeparator)
305
292
}
306
- try serializePrimitiveKeyValuePair (
307
- array. last!,
308
- forKey: elementKey,
309
- separator: keyAndValueSeparator
310
- )
293
+ try serializePrimitiveKeyValuePair ( array. last!, forKey: elementKey, separator: keyAndValueSeparator)
311
294
}
312
295
}
313
296
if let containerKeyAndValue = configuration. containerKeyAndValueSeparator {
0 commit comments