@@ -25,22 +25,19 @@ public struct NaiveDate: Equatable, Hashable, Comparable, LosslessStringConverti
2525 }
2626
2727 public static func == ( lhs: NaiveDate , rhs: NaiveDate ) -> Bool {
28- return lhs. year == rhs . year && lhs. month == rhs. month && lhs . day == rhs. day
28+ return ( lhs. year, lhs . month , lhs. day ) == ( rhs. year , rhs . month , rhs. day)
2929 }
3030
3131 public static func < ( lhs: NaiveDate , rhs: NaiveDate ) -> Bool {
32- if lhs. year != rhs. year { return lhs. year < rhs. year }
33- if lhs. month != rhs. month { return lhs. month < rhs. month }
34- return lhs. day < rhs. day
32+ return ( lhs. year, lhs. month, lhs. day) < ( rhs. year, rhs. month, rhs. day)
3533 }
3634
3735 // MARK: LosslessStringConvertible
3836
3937 /// Creates a naive date from a given string (e.g. "2017-12-30").
4038 public init ? ( _ string: String ) {
4139 // Not using `ISO8601DateFormatter` because it only works with `Date`
42- guard let cmps = _components ( from: string, separator: " - " ) ,
43- cmps. count == 3 else { return nil }
40+ guard let cmps = _components ( from: string, separator: " - " ) , cmps. count == 3 else { return nil }
4441 self = NaiveDate ( year: cmps [ 0 ] , month: cmps [ 1 ] , day: cmps [ 2 ] )
4542 }
4643
@@ -99,13 +96,11 @@ public struct NaiveTime: Equatable, Hashable, Comparable, LosslessStringConverti
9996 // MARK: Equatable, Comparable
10097
10198 public static func == ( lhs: NaiveTime , rhs: NaiveTime ) -> Bool {
102- return lhs. hour == rhs . hour && lhs. minute == rhs. minute && lhs . second == rhs. second
99+ return ( lhs. hour, lhs . minute , lhs. second ) == ( rhs. hour , rhs . minute , rhs. second)
103100 }
104101
105102 public static func < ( lhs: NaiveTime , rhs: NaiveTime ) -> Bool {
106- if lhs. hour != rhs. hour { return lhs. hour < rhs. hour }
107- if lhs. minute != rhs. minute { return lhs. minute < rhs. minute }
108- return lhs. second < rhs. second
103+ return ( lhs. hour, lhs. minute, lhs. second) < ( rhs. hour, rhs. minute, rhs. second)
109104 }
110105
111106 // MARK: LosslessStringConvertible
0 commit comments