Skip to content

Commit 4999448

Browse files
committed
[Foundation] URLComponents: Modernize hashing
1 parent f07b8e1 commit 4999448

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

Darwin/Foundation-swiftoverlay/URLComponents.swift

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -292,8 +292,8 @@ public struct URLComponents : ReferenceConvertible, Hashable, Equatable, _Mutabl
292292
set { _applyMutation { $0.percentEncodedQueryItems = newValue } }
293293
}
294294

295-
public var hashValue: Int {
296-
return _handle.map { $0.hash }
295+
public func hash(into hasher: inout Hasher) {
296+
hasher.combine(_handle._uncopiedReference())
297297
}
298298

299299
// MARK: - Bridging
@@ -404,7 +404,9 @@ public struct URLQueryItem : ReferenceConvertible, Hashable, Equatable {
404404
set { _queryItem = NSURLQueryItem(name: name, value: newValue) }
405405
}
406406

407-
public var hashValue: Int { return _queryItem.hash }
407+
public func hash(into hasher: inout Hasher) {
408+
hasher.combine(_queryItem)
409+
}
408410

409411
@available(macOS 10.10, iOS 8.0, *)
410412
public static func ==(lhs: URLQueryItem, rhs: URLQueryItem) -> Bool {

0 commit comments

Comments
 (0)