Skip to content

Commit 0e2ac90

Browse files
committed
Fix redundant constaints warnings with Box types
1 parent f951330 commit 0e2ac90

File tree

7 files changed

+11
-14
lines changed

7 files changed

+11
-14
lines changed

benchmark/single-source/DictTest.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ class Box<T : Hashable> : Hashable {
157157
return value.hashValue
158158
}
159159

160-
static func ==<T: Equatable>(lhs: Box<T>, rhs: Box<T>) -> Bool {
160+
static func ==(lhs: Box, rhs: Box) -> Bool {
161161
return lhs.value == rhs.value
162162
}
163163
}

benchmark/single-source/DictTest2.swift

+2-2
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ public func run_Dictionary2(_ N: Int) {
3737
CheckResults(res == ref_result, "Incorrect results in Dictionary2: \(res) != \(ref_result)")
3838
}
3939

40-
class Box<T : Hashable> : Hashable where T : Equatable {
40+
class Box<T : Hashable> : Hashable {
4141
var value: T
4242

4343
init(_ v: T) {
@@ -48,7 +48,7 @@ class Box<T : Hashable> : Hashable where T : Equatable {
4848
return value.hashValue
4949
}
5050

51-
static func ==<T: Equatable>(lhs: Box<T>, rhs: Box<T>) -> Bool {
51+
static func ==(lhs: Box, rhs: Box) -> Bool {
5252
return lhs.value == rhs.value
5353
}
5454
}

benchmark/single-source/DictTest3.swift

+4-7
Original file line numberDiff line numberDiff line change
@@ -54,13 +54,10 @@ class Box<T : Hashable> : Hashable {
5454
var hashValue: Int {
5555
return value.hashValue
5656
}
57-
}
58-
59-
extension Box : Equatable {
60-
}
61-
62-
func ==<T: Equatable>(lhs: Box<T>, rhs: Box<T>) -> Bool {
63-
return lhs.value == rhs.value
57+
58+
static func ==(lhs: Box, rhs: Box) -> Bool {
59+
return lhs.value == rhs.value
60+
}
6461
}
6562

6663
@inline(never)

benchmark/single-source/DictionaryRemove.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ class Box<T : Hashable> : Hashable {
5353
return value.hashValue
5454
}
5555

56-
static func ==<T: Equatable>(lhs: Box<T>, rhs: Box<T>) -> Bool {
56+
static func ==(lhs: Box, rhs: Box) -> Bool {
5757
return lhs.value == rhs.value
5858
}
5959
}

benchmark/single-source/DictionarySwap.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ class Box<T : Hashable> : Hashable {
5656
return value.hashValue
5757
}
5858

59-
static func ==<T: Equatable>(lhs: Box<T>, rhs: Box<T>) -> Bool {
59+
static func ==(lhs: Box, rhs: Box) -> Bool {
6060
return lhs.value == rhs.value
6161
}
6262
}

benchmark/single-source/RGBHistogram.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ class Box<T : Hashable> : Hashable {
124124
return value.hashValue
125125
}
126126

127-
static func ==<T: Equatable>(lhs: Box<T>, rhs: Box<T>) -> Bool {
127+
static func ==(lhs: Box, rhs: Box) -> Bool {
128128
return lhs.value == rhs.value
129129
}
130130
}

benchmark/single-source/SetTests.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ class Box<T : Hashable> : Hashable {
115115
return value.hashValue
116116
}
117117

118-
static func ==<T: Equatable>(lhs: Box<T>, rhs: Box<T>) -> Bool {
118+
static func ==(lhs: Box, rhs: Box) -> Bool {
119119
return lhs.value == rhs.value
120120
}
121121
}

0 commit comments

Comments
 (0)