From f82a4f683c2ea09a863ced552d958428f77fde1e Mon Sep 17 00:00:00 2001 From: 1024jp <1024jp@wolfrosch.com> Date: Sat, 29 Apr 2023 17:37:25 +0900 Subject: [PATCH] Style code --- .swiftlint.yml | 2 +- Package.swift | 9 +++------ Sources/Gzip/Data+Gzip.swift | 26 +++++++++++++------------- 3 files changed, 17 insertions(+), 20 deletions(-) diff --git a/.swiftlint.yml b/.swiftlint.yml index 54c6dd5..b58225b 100644 --- a/.swiftlint.yml +++ b/.swiftlint.yml @@ -28,6 +28,6 @@ trailing_whitespace: ignores_empty_lines: true vertical_whitespace: - max_empty_lines: 3 + max_empty_lines: 2 line_length: 200 diff --git a/Package.swift b/Package.swift index 87d366b..61f6a97 100644 --- a/Package.swift +++ b/Package.swift @@ -11,12 +11,9 @@ let package = Package( .target(name: "Gzip", dependencies: ["system-zlib"]), .target(name: "system-zlib"), .testTarget( - name: "GzipTests", - dependencies: ["Gzip"], - resources: [.copy("./test.txt.gz")] + name: "GzipTests", + dependencies: ["Gzip"], + resources: [.copy("./test.txt.gz")] ), - ], - swiftLanguageVersions: [ - .v5, ] ) diff --git a/Sources/Gzip/Data+Gzip.swift b/Sources/Gzip/Data+Gzip.swift index 92ee408..076fe65 100644 --- a/Sources/Gzip/Data+Gzip.swift +++ b/Sources/Gzip/Data+Gzip.swift @@ -113,7 +113,7 @@ public struct GzipError: Swift.Error { internal init(code: Int32, msg: UnsafePointer?) { - self.message = msg.flatMap { String(validatingUTF8: $0) } ?? "Unknown gzip error" + self.message = msg.flatMap(String.init(validatingUTF8:)) ?? "Unknown gzip error" self.kind = Kind(code: code) } @@ -130,18 +130,18 @@ private extension GzipError.Kind { init(code: Int32) { switch code { - case Z_STREAM_ERROR: - self = .stream - case Z_DATA_ERROR: - self = .data - case Z_MEM_ERROR: - self = .memory - case Z_BUF_ERROR: - self = .buffer - case Z_VERSION_ERROR: - self = .version - default: - self = .unknown(code: Int(code)) + case Z_STREAM_ERROR: + self = .stream + case Z_DATA_ERROR: + self = .data + case Z_MEM_ERROR: + self = .memory + case Z_BUF_ERROR: + self = .buffer + case Z_VERSION_ERROR: + self = .version + default: + self = .unknown(code: Int(code)) } } }