Skip to content

Commit

Permalink
Style code
Browse files Browse the repository at this point in the history
  • Loading branch information
1024jp committed Apr 29, 2023
1 parent 527bdda commit f82a4f6
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 20 deletions.
2 changes: 1 addition & 1 deletion .swiftlint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,6 @@ trailing_whitespace:
ignores_empty_lines: true

vertical_whitespace:
max_empty_lines: 3
max_empty_lines: 2

line_length: 200
9 changes: 3 additions & 6 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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,
]
)
26 changes: 13 additions & 13 deletions Sources/Gzip/Data+Gzip.swift
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ public struct GzipError: Swift.Error {

internal init(code: Int32, msg: UnsafePointer<CChar>?) {

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)
}

Expand All @@ -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))
}
}
}
Expand Down

0 comments on commit f82a4f6

Please sign in to comment.