Merge pull request #1803 from GitHawkApp/synthesized-equatable

Synthesize Equatable conformances
This commit is contained in:
Ryan Nystrom
2018-05-11 09:11:14 -04:00
committed by GitHub
4 changed files with 2 additions and 34 deletions

View File

@@ -8,7 +8,7 @@
import Foundation
struct Bookmark: Codable {
struct Bookmark: Codable, Equatable {
let type: NotificationType
let name: String
let owner: String
@@ -35,18 +35,6 @@ struct Bookmark: Codable {
}
}
extension Bookmark: Equatable {
static func ==(lhs: Bookmark, rhs: Bookmark) -> Bool {
return lhs.type == rhs.type &&
lhs.name == rhs.name &&
lhs.owner == rhs.owner &&
lhs.number == rhs.number &&
lhs.title == rhs.title &&
lhs.hasIssueEnabled == rhs.hasIssueEnabled &&
lhs.defaultBranch == rhs.defaultBranch
}
}
extension Bookmark: Filterable {
func match(query: String) -> Bool {
let lowerQuery = query.lowercased()

View File

@@ -14,12 +14,6 @@ struct FileChanges: Equatable {
let additions: Int
let deletions: Int
let changedFiles: Int
static func == (lhs: FileChanges, rhs: FileChanges) -> Bool {
return lhs.additions == rhs.additions
&& lhs.deletions == rhs.deletions
&& lhs.changedFiles == rhs.changedFiles
}
}
protocol IssueType {

View File

@@ -8,18 +8,9 @@
import Foundation
struct RepositoryDetails: Codable {
struct RepositoryDetails: Codable, Equatable {
let owner: String
let name: String
let defaultBranch: String
let hasIssuesEnabled: Bool
}
extension RepositoryDetails: Equatable {
static func == (lhs: RepositoryDetails, rhs: RepositoryDetails) -> Bool {
return lhs.owner == rhs.owner &&
lhs.name == rhs.name &&
lhs.defaultBranch == rhs.defaultBranch &&
lhs.hasIssuesEnabled == rhs.hasIssuesEnabled
}
}

View File

@@ -73,11 +73,6 @@ final class NSAttributedStringSizing: NSObject, ListDiffable {
return attributedText.combineHash(with: width)
}
public static func == (lhs: CacheKey, rhs: CacheKey) -> Bool {
return lhs.width == rhs.width
&& lhs.attributedText == rhs.attributedText
}
}
private static let globalSizeCache = LRUCache<CacheKey, CGSize>(