Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: FavIcon/Utils.swift

Issue 29664569: Favicon: Issue 6245 - SwiftLinted project files (Closed)
Patch Set: Favicon: Issue 6245 - Swiftlinted project files Created Jan. 16, 2018, 12:55 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: FavIcon/Utils.swift
diff --git a/FavIcon/Utils.swift b/FavIcon/Utils.swift
index 5f738d3db092c50f32e51ad0057bb18ce426f179..7e543847cdad70b860d9c46294937cad99e957de 100644
--- a/FavIcon/Utils.swift
+++ b/FavIcon/Utils.swift
@@ -21,14 +21,14 @@ extension String {
func parseAsHTTPContentTypeHeader() -> (mimeType: String, encoding: String.Encoding) {
let headerComponents =
components(separatedBy: ";")
- .map { $0.trimmingCharacters(in: .whitespaces) }
+ .map { $0.trimmingCharacters(in: .whitespaces) }
d108 2018/02/13 21:48:44 Nit: The original indentation was clearer with res
if headerComponents.count > 1 {
let parameters =
headerComponents[1..<headerComponents.count]
- .filter { $0.contains("=") }
- .map { $0.components(separatedBy: "=") }
- .toDictionary { ($0[0], $0[1]) }
+ .filter { $0.contains("=") }
d108 2018/02/13 21:48:45 Nit: The original indentation was clearer with res
+ .map { $0.components(separatedBy: "=") }
+ .toDictionary { ($0[0], $0[1]) }
// Default according to RFC is ISO-8859-1, but probably nothing obeys that, so default
// to UTF-8 instead.
@@ -48,22 +48,38 @@ extension String {
//swiftlint:disable cyclomatic_complexity
func parseAsStringEncoding() -> String.Encoding? {
switch lowercased() {
- case "iso-8859-1", "latin1": return String.Encoding.isoLatin1
- case "iso-8859-2", "latin2": return String.Encoding.isoLatin2
- case "iso-2022-jp": return String.Encoding.iso2022JP
- case "shift_jis": return String.Encoding.shiftJIS
- case "us-ascii": return String.Encoding.ascii
- case "utf-8": return String.Encoding.utf8
- case "utf-16": return String.Encoding.utf16
- case "utf-32": return String.Encoding.utf32
- case "utf-32be": return String.Encoding.utf32BigEndian
- case "utf-32le": return String.Encoding.utf32LittleEndian
- case "windows-1250": return String.Encoding.windowsCP1250
- case "windows-1251": return String.Encoding.windowsCP1251
- case "windows-1252": return String.Encoding.windowsCP1252
- case "windows-1253": return String.Encoding.windowsCP1253
- case "windows-1254": return String.Encoding.windowsCP1254
- case "x-mac-roman": return String.Encoding.macOSRoman
+ case "iso-8859-1", "latin1":
+ return String.Encoding.isoLatin1
+ case "iso-8859-2", "latin2":
+ return String.Encoding.isoLatin2
+ case "iso-2022-jp":
+ return String.Encoding.iso2022JP
+ case "shift_jis":
+ return String.Encoding.shiftJIS
+ case "us-ascii":
+ return String.Encoding.ascii
+ case "utf-8":
+ return String.Encoding.utf8
+ case "utf-16":
+ return String.Encoding.utf16
+ case "utf-32":
+ return String.Encoding.utf32
+ case "utf-32be":
+ return String.Encoding.utf32BigEndian
+ case "utf-32le":
+ return String.Encoding.utf32LittleEndian
+ case "windows-1250":
+ return String.Encoding.windowsCP1250
+ case "windows-1251":
+ return String.Encoding.windowsCP1251
+ case "windows-1252":
+ return String.Encoding.windowsCP1252
+ case "windows-1253":
+ return String.Encoding.windowsCP1253
+ case "windows-1254":
+ return String.Encoding.windowsCP1254
+ case "x-mac-roman":
+ return String.Encoding.macOSRoman
default:
return nil
}

Powered by Google App Engine
This is Rietveld