Skip to content

Commit 04b2d30

Browse files
authored
Updates for Swift 5.0
Removes unnecessary equatable implementations, since default implementations of `Equatable` has identical result.
1 parent 7f6f5a5 commit 04b2d30

File tree

1 file changed

+0
-20
lines changed

1 file changed

+0
-20
lines changed

Points Lines Planes/Points Lines Planes/2D/Line2D.swift

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -14,27 +14,11 @@ struct Line2D: Equatable {
1414
enum Slope: Equatable {
1515
case finite(slope: Double)
1616
case infinite(offset: Double)
17-
18-
static func ==(lhs: Slope, rhs: Slope) -> Bool {
19-
switch (lhs, rhs) {
20-
case (.finite(let slope1), .finite(let slope2)): return slope1 == slope2
21-
case (.infinite(let offset1), .infinite(let offset2)): return offset1 == offset2
22-
default: return false
23-
}
24-
}
2517
}
2618

2719
enum Direction: Equatable {
2820
case increasing
2921
case decreasing
30-
31-
static func ==(lhs: Direction, rhs: Direction) -> Bool {
32-
switch (lhs, rhs) {
33-
case (.increasing, .increasing): return true
34-
case (.decreasing, .decreasing): return true
35-
default: return false
36-
}
37-
}
3822
}
3923

4024
init(from p1: Point2D, to p2: Point2D) {
@@ -154,8 +138,4 @@ struct Line2D: Equatable {
154138
return Line2D(slope: .finite(slope: 0), offset: p.y, direction: dir)
155139
}
156140
}
157-
158-
static func ==(lhs: Line2D, rhs: Line2D) -> Bool {
159-
return lhs.slope == rhs.slope && lhs.offset == rhs.offset && lhs.direction == rhs.direction
160-
}
161141
}

0 commit comments

Comments
 (0)