Skip to content

Commit 167424a

Browse files
authored
Remove a few redundant conformance implementations (#1054)
1 parent 1c05ea6 commit 167424a

File tree

6 files changed

+2
-81
lines changed

6 files changed

+2
-81
lines changed

Sources/SwiftDocC/Indexing/Navigator/AvailabilityIndex+Ext.swift

Lines changed: 1 addition & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -331,11 +331,7 @@ extension Platform.Version: CustomStringConvertible, Equatable, Comparable, Coda
331331
return "\(majorVersion).\(minorVersion)"
332332
}
333333

334-
// MARK: - Equatable and Comparable
335-
336-
public static func == (lhs: Platform.Version, rhs: Platform.Version) -> Bool {
337-
return lhs.majorVersion == rhs.majorVersion && lhs.minorVersion == rhs.minorVersion && lhs.patchVersion == rhs.patchVersion
338-
}
334+
// MARK: Comparable
339335

340336
public static func < (lhs: Platform.Version, rhs: Platform.Version) -> Bool {
341337
if lhs.majorVersion != rhs.majorVersion { return lhs.majorVersion < rhs.majorVersion }
@@ -344,37 +340,6 @@ extension Platform.Version: CustomStringConvertible, Equatable, Comparable, Coda
344340
return false // Equals, so return false.
345341
}
346342

347-
// MARK: Hashable
348-
349-
public func hash(into hasher: inout Hasher) {
350-
hasher.combine(majorVersion)
351-
hasher.combine(minorVersion)
352-
hasher.combine(patchVersion)
353-
}
354-
355-
// MARK: Codable
356-
357-
enum CodingKeys: String, CodingKey {
358-
case majorVersion
359-
case minorVersion
360-
case patchVersion
361-
}
362-
363-
public init(from decoder: Decoder) throws {
364-
let values = try decoder.container(keyedBy: CodingKeys.self)
365-
let majorVersion = try values.decode(Int.self, forKey: .majorVersion)
366-
let minorVersion = try values.decode(Int.self, forKey: .minorVersion)
367-
let patchVersion = try values.decode(Int.self, forKey: .patchVersion)
368-
self.init(majorVersion: majorVersion, minorVersion: minorVersion, patchVersion: patchVersion)
369-
}
370-
371-
public func encode(to encoder: Encoder) throws {
372-
var container = encoder.container(keyedBy: CodingKeys.self)
373-
try container.encode(majorVersion, forKey: .majorVersion)
374-
try container.encode(minorVersion, forKey: .minorVersion)
375-
try container.encode(patchVersion, forKey: .patchVersion)
376-
}
377-
378343
// MARK: UInt32 version encoding
379344
public init(uint32: UInt32) {
380345
var representation = uint32

Sources/SwiftDocC/Indexing/Navigator/NavigatorItem.swift

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -151,26 +151,6 @@ public final class NavigatorItem: Serializable, Codable, Equatable, CustomString
151151
return data
152152
}
153153

154-
// MARK: - Equatable
155-
156-
public static func == (lhs: NavigatorItem, rhs: NavigatorItem) -> Bool {
157-
return lhs.pageType == rhs.pageType &&
158-
lhs.languageID == rhs.languageID &&
159-
lhs.title == rhs.title &&
160-
lhs.platformMask == rhs.platformMask &&
161-
lhs.availabilityID == rhs.availabilityID
162-
}
163-
164-
// MARK: - Hasher
165-
166-
public func hash(into hasher: inout Hasher) {
167-
hasher.combine(pageType)
168-
hasher.combine(languageID)
169-
hasher.combine(title)
170-
hasher.combine(platformMask)
171-
hasher.combine(availabilityID)
172-
}
173-
174154
// MARK: - Description
175155

176156
public var description: String {

Sources/SwiftDocC/Infrastructure/Bundle Assets/DataAssetManager.swift

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -354,9 +354,4 @@ public struct AssetReference: Hashable, Codable {
354354
self.assetName = assetName
355355
self.bundleIdentifier = bundleIdentifier
356356
}
357-
358-
public func hash(into hasher: inout Hasher) {
359-
hasher.combine(assetName)
360-
hasher.combine(bundleIdentifier)
361-
}
362357
}

Sources/SwiftDocC/Model/Name.swift

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -22,15 +22,6 @@ extension DocumentationNode {
2222
/// The name of the symbol.
2323
case symbol(name: String)
2424

25-
public func hash(into hasher: inout Hasher) {
26-
switch self {
27-
case .conceptual(let text):
28-
hasher.combine(text)
29-
case .symbol(let name):
30-
hasher.combine(name)
31-
}
32-
}
33-
3425
public var description: String {
3526
switch self {
3627
case .conceptual(let title):

Sources/SwiftDocC/Model/Rendering/Tutorial/References/DownloadReference.swift

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -91,12 +91,6 @@ public struct DownloadReference: RenderReference, URLReference, Equatable {
9191
try container.encode(url, forKey: .url)
9292
}
9393
}
94-
95-
static public func ==(lhs: DownloadReference, rhs: DownloadReference) -> Bool {
96-
lhs.identifier == rhs.identifier
97-
&& lhs.url == rhs.url
98-
&& lhs.checksum == rhs.checksum
99-
}
10094
}
10195

10296
extension DownloadReference {

Sources/SwiftDocC/Model/Rendering/Variants/VariantCollection+Variant.swift

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,4 @@ public extension VariantCollection {
4141
}
4242
}
4343

44-
extension VariantCollection.Variant: Equatable where Value: Equatable {
45-
public static func == (lhs: VariantCollection<Value>.Variant, rhs: VariantCollection<Value>.Variant) -> Bool {
46-
return lhs.traits == rhs.traits && lhs.patch == rhs.patch
47-
}
48-
}
44+
extension VariantCollection.Variant: Equatable where Value: Equatable {}

0 commit comments

Comments
 (0)