Skip to content

Commit 7336c0c

Browse files
[gardening] remove horizontal whitespace from whitespace-only lines
1 parent 5111d09 commit 7336c0c

File tree

2 files changed

+82
-82
lines changed

2 files changed

+82
-82
lines changed

Sources/TSCUtility/Version.swift

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ public enum VersionError: Error, CustomStringConvertible {
5757
case nonAlphaNumerHyphenalPrereleaseIdentifiers(_ identifiers: [String])
5858
/// Some or all of the build metadata identifiers contain characters other than alpha-numerics and hyphens.
5959
case nonAlphaNumerHyphenalBuildMetadataIdentifiers(_ identifiers: [String])
60-
60+
6161
public var description: String {
6262
switch self {
6363
case let .nonASCIIVersionString(versionString):
@@ -99,18 +99,18 @@ extension Version {
9999
guard versionString.allSatisfy(\.isASCII) else {
100100
throw VersionError.nonASCIIVersionString(versionString)
101101
}
102-
102+
103103
let metadataDelimiterIndex = versionString.firstIndex(of: "+")
104104
// SemVer 2.0.0 requires that pre-release identifiers come before build metadata identifiers
105105
let prereleaseDelimiterIndex = versionString[..<(metadataDelimiterIndex ?? versionString.endIndex)].firstIndex(of: "-")
106-
106+
107107
let versionCore = versionString[..<(prereleaseDelimiterIndex ?? metadataDelimiterIndex ?? versionString.endIndex)]
108108
let versionCoreIdentifiers = versionCore.split(separator: ".", omittingEmptySubsequences: false)
109109

110110
guard versionCoreIdentifiers.count == 3 else {
111111
throw VersionError.invalidVersionCoreIdentifiersCount(versionCoreIdentifiers.map { String($0) })
112112
}
113-
113+
114114
guard
115115
// Major, minor, and patch versions must be ASCII numbers, according to the semantic versioning standard.
116116
// Converting each identifier from a substring to an integer doubles as checking if the identifiers have non-numeric characters.
@@ -120,11 +120,11 @@ extension Version {
120120
else {
121121
throw VersionError.nonNumericalOrEmptyVersionCoreIdentifiers(versionCoreIdentifiers.map { String($0) })
122122
}
123-
123+
124124
self.major = major
125125
self.minor = minor
126126
self.patch = patch
127-
127+
128128
if let prereleaseDelimiterIndex = prereleaseDelimiterIndex {
129129
let prereleaseStartIndex = versionString.index(after: prereleaseDelimiterIndex)
130130
let prereleaseIdentifiers = versionString[prereleaseStartIndex..<(metadataDelimiterIndex ?? versionString.endIndex)].split(separator: ".", omittingEmptySubsequences: false)
@@ -150,17 +150,17 @@ extension Version {
150150
}
151151

152152
extension Version: Comparable, Hashable {
153-
153+
154154
func isEqualWithoutPrerelease(_ other: Version) -> Bool {
155155
return major == other.major && minor == other.minor && patch == other.patch
156156
}
157-
157+
158158
// Although `Comparable` inherits from `Equatable`, it does not provide a new default implementation of `==`, but instead uses `Equatable`'s default synthesised implementation. The compiler-synthesised `==`` is composed of [member-wise comparisons](https://github.com/apple/swift-evolution/blob/main/proposals/0185-synthesize-equatable-hashable.md#implementation-details), which leads to a false `false` when 2 semantic versions differ by only their build metadata identifiers, contradicting SemVer 2.0.0's [comparison rules](https://semver.org/#spec-item-10).
159159
@inlinable
160160
public static func == (lhs: Version, rhs: Version) -> Bool {
161161
!(lhs < rhs) && !(lhs > rhs)
162162
}
163-
163+
164164
public static func < (lhs: Version, rhs: Version) -> Bool {
165165
let lhsComparators = [lhs.major, lhs.minor, lhs.patch]
166166
let rhsComparators = [rhs.major, rhs.minor, rhs.patch]
@@ -174,7 +174,7 @@ extension Version: Comparable, Hashable {
174174
}
175175

176176
guard rhs.prereleaseIdentifiers.count > 0 else {
177-
return true // Prerelease lhs < non-prerelease rhs
177+
return true // Prerelease lhs < non-prerelease rhs
178178
}
179179

180180
let zippedIdentifiers = zip(lhs.prereleaseIdentifiers, rhs.prereleaseIdentifiers)
@@ -198,7 +198,7 @@ extension Version: Comparable, Hashable {
198198

199199
return lhs.prereleaseIdentifiers.count < rhs.prereleaseIdentifiers.count
200200
}
201-
201+
202202
// Custom `Equatable` conformance leads to custom `Hashable` conformance.
203203
// [SR-11588](https://bugs.swift.org/browse/SR-11588)
204204
public func hash(into hasher: inout Hasher) {

0 commit comments

Comments
 (0)