Skip to content

Commit cf9ed49

Browse files
committed
Remove redundant nested function in String.Encoding(ianaName:).
In response to: - #1286 (comment)
1 parent d4ab876 commit cf9ed49

File tree

1 file changed

+5
-14
lines changed

1 file changed

+5
-14
lines changed

Sources/FoundationEssentials/String/String+Encoding+Names.swift

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -143,22 +143,13 @@ extension String.Encoding {
143143
.utf32LittleEndian,
144144
]
145145

146-
func __determineEncoding() -> String.Encoding? {
147-
for encoding in possibilities {
148-
guard let ianaCharset = encoding._ianaCharset else {
149-
continue
150-
}
151-
if ianaCharset.matches(charsetName) {
152-
return encoding
153-
}
146+
for encoding in possibilities {
147+
if encoding._ianaCharset!.matches(charsetName) {
148+
self = encoding
149+
return
154150
}
155-
return nil
156151
}
157-
158-
guard let encoding = __determineEncoding() else {
159-
return nil
160-
}
161-
self = encoding
152+
return nil
162153
}
163154
}
164155

0 commit comments

Comments
 (0)