diff --git a/Result/Result.swift b/Result/Result.swift index e1468ba..350fa04 100644 --- a/Result/Result.swift +++ b/Result/Result.swift @@ -187,7 +187,7 @@ public enum NoError: Swift.Error { } /// A type-erased error which wraps an arbitrary error instance. This should be /// useful for generic contexts. -public struct AnyError: Swift.Error, ErrorProtocolConvertible, Equatable, CustomStringConvertible { +public struct AnyError: Swift.Error, ErrorProtocolConvertible, CustomStringConvertible { /// The underlying error. public let error: Swift.Error @@ -202,11 +202,6 @@ public struct AnyError: Swift.Error, ErrorProtocolConvertible, Equatable, Custom return AnyError(error) } - public static func ==(lhs: AnyError, rhs: AnyError) -> Bool { - return lhs.error._code == rhs.error._code - && lhs.error._domain == rhs.error._domain - } - public var description: String { return String(describing: error) } diff --git a/Tests/ResultTests/ResultTests.swift b/Tests/ResultTests/ResultTests.swift index 31853cb..b5a7dbe 100644 --- a/Tests/ResultTests/ResultTests.swift +++ b/Tests/ResultTests/ResultTests.swift @@ -193,6 +193,13 @@ let failure2 = Result.failure(error2) // MARK: - Helpers +extension AnyError: Equatable { + public static func ==(lhs: AnyError, rhs: AnyError) -> Bool { + return lhs.error._code == rhs.error._code + && lhs.error._domain == rhs.error._domain + } +} + #if !os(Linux) func attempt(_ value: T, succeed: Bool, error: NSErrorPointer) -> T? {