Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove useless Equatable constraint #106

Merged
merged 3 commits into from
Jan 16, 2025
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Benchmarks/Parser/AsyncSyncSequence.swift
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ final class AsyncSyncSequence<Base: Sequence>: AsyncSequence {
}

func makeAsyncIterator() -> Iterator {
defer { self.base = nil } // release the reference so no CoW is triggered
defer { self.base = nil } // release the reference so no CoW is triggered
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
defer { self.base = nil } // release the reference so no CoW is triggered
defer { self.base = nil } // release the reference so no CoW is triggered

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is swift-format's doing

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

... That's bizarre, wrong, stupid, pointless, and so forth. Oh well.

return Iterator(base.unsafelyUnwrapped.makeIterator())
}
}
2 changes: 1 addition & 1 deletion Sources/MultipartKit/MultipartFormData.swift
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import Collections
import Foundation

enum MultipartFormData<Body: MultipartPartBodyElement>: Equatable, Sendable {
enum MultipartFormData<Body: MultipartPartBodyElement>: Sendable {
typealias Keyed = OrderedDictionary<String, MultipartFormData>

case single(MultipartPart<Body>)
Expand Down
4 changes: 2 additions & 2 deletions Sources/MultipartKit/MultipartPart.swift
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import HTTPTypes

public typealias MultipartPartBodyElement = Collection<UInt8> & Equatable & Sendable
public typealias MultipartPartBodyElement = Collection<UInt8> & Sendable

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

Expand Down
2 changes: 1 addition & 1 deletion Sources/MultipartKit/MultipartSection.swift
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import HTTPTypes

public enum MultipartSection<Body: MultipartPartBodyElement>: Equatable, Sendable {
public enum MultipartSection<Body: MultipartPartBodyElement>: Sendable {
case headerFields(HTTPFields)
case bodyChunk(Body)
case boundary(end: Bool)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
extension MultipartSection: Equatable where Body: Equatable {
public static func == (lhs: MultipartKit.MultipartSection<Body>, rhs: MultipartKit.MultipartSection<Body>) -> Bool {
switch (lhs, rhs) {
case let (.headerFields(lhsFields), .headerFields(rhsFields)):
lhsFields == rhsFields
case let (.bodyChunk(lhsChunk), .bodyChunk(rhsChunk)):
lhsChunk == rhsChunk
case (.boundary, .boundary):
true
default:
false
}
}
}
Loading