Skip to content

Commit c82e1de

Browse files
authored
Merge pull request #2134 from lorentey/delete-unnecessary-hashable-impls
2 parents 84b6511 + 5d000d0 commit c82e1de

13 files changed

+8
-140
lines changed

Foundation/FileManager.swift

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -884,14 +884,6 @@ public struct FileAttributeKey : RawRepresentable, Equatable, Hashable {
884884
self.rawValue = rawValue
885885
}
886886

887-
public func hash(into hasher: inout Hasher) {
888-
hasher.combine(rawValue)
889-
}
890-
891-
public static func ==(_ lhs: FileAttributeKey, _ rhs: FileAttributeKey) -> Bool {
892-
return lhs.rawValue == rhs.rawValue
893-
}
894-
895887
public static let type = FileAttributeKey(rawValue: "NSFileType")
896888
public static let size = FileAttributeKey(rawValue: "NSFileSize")
897889
public static let modificationDate = FileAttributeKey(rawValue: "NSFileModificationDate")
@@ -928,14 +920,6 @@ public struct FileAttributeType : RawRepresentable, Equatable, Hashable {
928920
self.rawValue = rawValue
929921
}
930922

931-
public func hash(into hasher: inout Hasher) {
932-
hasher.combine(rawValue)
933-
}
934-
935-
public static func ==(_ lhs: FileAttributeType, _ rhs: FileAttributeType) -> Bool {
936-
return lhs.rawValue == rhs.rawValue
937-
}
938-
939923
#if os(Windows)
940924
internal init(attributes: WIN32_FILE_ATTRIBUTE_DATA, atPath path: String) {
941925
if attributes.dwFileAttributes & DWORD(FILE_ATTRIBUTE_DIRECTORY) == DWORD(FILE_ATTRIBUTE_DIRECTORY) {

Foundation/HTTPCookie.swift

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,6 @@ public struct HTTPCookiePropertyKey : RawRepresentable, Equatable, Hashable {
1717
public init(rawValue: String) {
1818
self.rawValue = rawValue
1919
}
20-
21-
public func hash(into hasher: inout Hasher) {
22-
hasher.combine(rawValue)
23-
}
24-
25-
public static func ==(_ lhs: HTTPCookiePropertyKey, _ rhs: HTTPCookiePropertyKey) -> Bool {
26-
return lhs.rawValue == rhs.rawValue
27-
}
2820
}
2921

3022
extension HTTPCookiePropertyKey {

Foundation/NSAttributedString.swift

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,6 @@ extension NSAttributedString {
2020
public init(rawValue: String) {
2121
self.rawValue = rawValue
2222
}
23-
24-
public func hash(into hasher: inout Hasher) {
25-
hasher.combine(rawValue)
26-
}
27-
28-
public static func ==(left: NSAttributedString.Key, right: NSAttributedString.Key) -> Bool {
29-
return left.rawValue == right.rawValue
30-
}
3123
}
3224
}
3325

Foundation/NSCalendar.swift

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -66,10 +66,6 @@ extension NSCalendar {
6666
self.rawValue = rawValue
6767
}
6868

69-
public func hash(into hasher: inout Hasher) {
70-
hasher.combine(rawValue)
71-
}
72-
7369
public static let gregorian = NSCalendar.Identifier("gregorian")
7470
public static let buddhist = NSCalendar.Identifier("buddhist")
7571
public static let chinese = NSCalendar.Identifier("chinese")
@@ -137,10 +133,6 @@ extension NSCalendar {
137133
}
138134

139135
extension NSCalendar.Identifier {
140-
public static func ==(_ lhs: NSCalendar.Identifier, _ rhs: NSCalendar.Identifier) -> Bool {
141-
return lhs.rawValue == rhs.rawValue
142-
}
143-
144136
public static func <(_ lhs: NSCalendar.Identifier, _ rhs: NSCalendar.Identifier) -> Bool {
145137
return lhs.rawValue < rhs.rawValue
146138
}

Foundation/NSDecimalNumber.swift

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,6 @@ public struct NSExceptionName : RawRepresentable, Equatable, Hashable {
1818
public init(rawValue: String) {
1919
self.rawValue = rawValue
2020
}
21-
22-
public func hash(into hasher: inout Hasher) {
23-
hasher.combine(rawValue)
24-
}
25-
26-
public static func ==(_ lhs: NSExceptionName, _ rhs: NSExceptionName) -> Bool {
27-
return lhs.rawValue == rhs.rawValue
28-
}
2921
}
3022

3123
extension NSExceptionName {

Foundation/NSLocale.swift

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -177,10 +177,6 @@ extension NSLocale {
177177
self.rawValue = rawValue
178178
}
179179

180-
public func hash(into hasher: inout Hasher) {
181-
hasher.combine(rawValue)
182-
}
183-
184180
public static let identifier = NSLocale.Key(rawValue: "kCFLocaleIdentifierKey")
185181
public static let languageCode = NSLocale.Key(rawValue: "kCFLocaleLanguageCodeKey")
186182
public static let countryCode = NSLocale.Key(rawValue: "kCFLocaleCountryCodeKey")
@@ -213,13 +209,6 @@ extension NSLocale {
213209
}
214210

215211

216-
extension NSLocale.Key {
217-
public static func ==(_ lhs: NSLocale.Key, _ rhs: NSLocale.Key) -> Bool {
218-
return lhs.rawValue == rhs.rawValue
219-
}
220-
}
221-
222-
223212
extension NSLocale {
224213
public static let currentLocaleDidChangeNotification = NSNotification.Name(rawValue: "kCFLocaleCurrentLocaleDidChangeNotification")
225214
}

Foundation/NSNotification.swift

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,6 @@ open class NSNotification: NSObject, NSCopying, NSCoding {
1313
public init(rawValue: String) {
1414
self.rawValue = rawValue
1515
}
16-
17-
public func hash(into hasher: inout Hasher) {
18-
hasher.combine(rawValue)
19-
}
20-
21-
public static func ==(lhs: Name, rhs: Name) -> Bool {
22-
return lhs.rawValue == rhs.rawValue
23-
}
2416
}
2517

2618
private(set) open var name: Name

Foundation/NSString.swift

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -115,14 +115,6 @@ extension NSString {
115115

116116
public let rawValue: String
117117

118-
public var hashValue: Int {
119-
return self.rawValue.hashValue
120-
}
121-
122-
public static func ==(_ lhs: StringTransform, _ rhs: StringTransform) -> Bool {
123-
return lhs.rawValue == rhs.rawValue
124-
}
125-
126118
public init(_ rawValue: String) {
127119
self.rawValue = rawValue
128120
}

Foundation/NSURL.swift

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -75,14 +75,6 @@ public struct URLResourceKey : RawRepresentable, Equatable, Hashable {
7575
public init(_ rawValue: String) {
7676
self.rawValue = rawValue
7777
}
78-
79-
public func hash(into hasher: inout Hasher) {
80-
hasher.combine(rawValue)
81-
}
82-
83-
public static func ==(lhs: URLResourceKey, rhs: URLResourceKey) -> Bool {
84-
return lhs.rawValue == rhs.rawValue
85-
}
8678
}
8779

8880
extension URLResourceKey {
@@ -197,14 +189,6 @@ public struct URLFileResourceType : RawRepresentable, Equatable, Hashable {
197189
public init(_ rawValue: String) {
198190
self.rawValue = rawValue
199191
}
200-
201-
public func hash(into hasher: inout Hasher) {
202-
hasher.combine(rawValue)
203-
}
204-
205-
public static func ==(lhs: URLFileResourceType, rhs: URLFileResourceType) -> Bool {
206-
return lhs.rawValue == rhs.rawValue
207-
}
208192
}
209193

210194
extension URLFileResourceType {

Foundation/Progress.swift

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -399,9 +399,7 @@ open class Progress : NSObject {
399399
public let rawValue: String
400400
public init(_ rawValue: String) { self.rawValue = rawValue }
401401
public init(rawValue: String) { self.rawValue = rawValue }
402-
public func hash(into hasher: inout Hasher) { hasher.combine(rawValue) }
403-
public static func ==(_ lhs: FileOperationKind, _ rhs: FileOperationKind) -> Bool { return lhs.rawValue == rhs.rawValue }
404-
402+
405403
/// Use for indicating the progress represents a download.
406404
public static let downloading = FileOperationKind(rawValue: "NSProgressFileOperationKindDownloading")
407405

@@ -478,9 +476,7 @@ public struct ProgressKind : RawRepresentable, Equatable, Hashable {
478476
public let rawValue: String
479477
public init(_ rawValue: String) { self.rawValue = rawValue }
480478
public init(rawValue: String) { self.rawValue = rawValue }
481-
public func hash(into hasher: inout Hasher) { hasher.combine(rawValue) }
482-
public static func ==(_ lhs: ProgressKind, _ rhs: ProgressKind) -> Bool { return lhs.rawValue == rhs.rawValue }
483-
479+
484480
/// Indicates that the progress being performed is related to files.
485481
///
486482
/// Progress of this kind is assumed to use bytes as the unit of work being done and the default implementation of `localizedDescription` takes advantage of that to return more specific text than it could otherwise.
@@ -491,9 +487,7 @@ public struct ProgressUserInfoKey : RawRepresentable, Equatable, Hashable {
491487
public let rawValue: String
492488
public init(_ rawValue: String) { self.rawValue = rawValue }
493489
public init(rawValue: String) { self.rawValue = rawValue }
494-
public func hash(into hasher: inout Hasher) { hasher.combine(rawValue) }
495-
public static func ==(_ lhs: ProgressUserInfoKey, _ rhs: ProgressUserInfoKey) -> Bool { return lhs.rawValue == rhs.rawValue }
496-
490+
497491
/// How much time is probably left in the operation, as an NSNumber containing a number of seconds.
498492
///
499493
/// If this value is present, then `Progress` can present a more detailed `localizedAdditionalDescription`.

0 commit comments

Comments
 (0)