Skip to content

Commit 48c1058

Browse files
authored
Remove useless Equatable constraint (#106)
* Remove useless `Equatable` constraint * Fix missing import * Make benchmarks compile
1 parent 45bae90 commit 48c1058

File tree

6 files changed

+21
-6
lines changed

6 files changed

+21
-6
lines changed

Benchmarks/Parser/AsyncSyncSequence.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ final class AsyncSyncSequence<Base: Sequence>: AsyncSequence {
3131
}
3232

3333
func makeAsyncIterator() -> Iterator {
34-
defer { self.base = nil } // release the reference so no CoW is triggered
34+
defer { self.base = nil } // release the reference so no CoW is triggered
3535
return Iterator(base.unsafelyUnwrapped.makeIterator())
3636
}
3737
}

Benchmarks/Parser/Parser.swift

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import Algorithms
21
import Benchmark
32
import MultipartKit
43

Sources/MultipartKit/MultipartFormData.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import Collections
22
import Foundation
33

4-
enum MultipartFormData<Body: MultipartPartBodyElement>: Equatable, Sendable {
4+
enum MultipartFormData<Body: MultipartPartBodyElement>: Sendable {
55
typealias Keyed = OrderedDictionary<String, MultipartFormData>
66

77
case single(MultipartPart<Body>)

Sources/MultipartKit/MultipartPart.swift

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import HTTPTypes
22

3-
public typealias MultipartPartBodyElement = Collection<UInt8> & Equatable & Sendable
3+
public typealias MultipartPartBodyElement = Collection<UInt8> & Sendable
44

55
/// Represents a single part of a multipart-encoded message.
6-
public struct MultipartPart<Body: MultipartPartBodyElement>: Equatable, Sendable {
6+
public struct MultipartPart<Body: MultipartPartBodyElement>: Sendable {
77
/// The header fields for this part.
88
public var headerFields: HTTPFields
99

Sources/MultipartKit/MultipartSection.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import HTTPTypes
22

3-
public enum MultipartSection<Body: MultipartPartBodyElement>: Equatable, Sendable {
3+
public enum MultipartSection<Body: MultipartPartBodyElement>: Sendable {
44
case headerFields(HTTPFields)
55
case bodyChunk(Body)
66
case boundary(end: Bool)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import MultipartKit
2+
3+
extension MultipartSection: Equatable where Body: Equatable {
4+
public static func == (lhs: MultipartKit.MultipartSection<Body>, rhs: MultipartKit.MultipartSection<Body>) -> Bool {
5+
switch (lhs, rhs) {
6+
case let (.headerFields(lhsFields), .headerFields(rhsFields)):
7+
lhsFields == rhsFields
8+
case let (.bodyChunk(lhsChunk), .bodyChunk(rhsChunk)):
9+
lhsChunk == rhsChunk
10+
case (.boundary, .boundary):
11+
true
12+
default:
13+
false
14+
}
15+
}
16+
}

0 commit comments

Comments
 (0)