deleted unnecessary Equatable and Hashable custom implementations

This commit is contained in:
John Estropia
2018-09-19 11:06:19 +09:00
parent ab40532801
commit 45e110755d
19 changed files with 125 additions and 193 deletions

View File

@@ -68,40 +68,6 @@ public enum MigrationResult: Hashable {
}
// MARK: Equatable
public static func == (lhs: MigrationResult, rhs: MigrationResult) -> Bool {
switch (lhs, rhs) {
case (.success(let migrationTypes1), .success(let migrationTypes2)):
return migrationTypes1 == migrationTypes2
case (.failure(let error1), .failure(let error2)):
return error1 == error2
default:
return false
}
}
// MARK: Hashable
public var hashValue: Int {
switch self {
case .success(let migrationTypes):
return true.hashValue
^ migrationTypes.map { $0.hashValue }.reduce(0, ^).hashValue
case .failure(let error):
return false.hashValue ^ error.hashValue
}
}
// MARK: Internal
internal init(_ migrationTypes: [MigrationType]) {