Skip to content

Audit pass on inline and initialization #271

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

Merged
merged 1 commit into from
Jun 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ extension AsyncInclusiveReductionsSequence: AsyncSequence {
internal let transform: @Sendable (Base.Element, Base.Element) async -> Base.Element

@inlinable
internal init(
init(
_ iterator: Base.AsyncIterator,
transform: @Sendable @escaping (Base.Element, Base.Element) async -> Base.Element
) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ extension AsyncThrowingInclusiveReductionsSequence: AsyncSequence {
internal let transform: @Sendable (Base.Element, Base.Element) async throws -> Base.Element

@inlinable
internal init(
init(
_ iterator: Base.AsyncIterator,
transform: @Sendable @escaping (Base.Element, Base.Element) async throws -> Base.Element
) {
Expand Down
8 changes: 4 additions & 4 deletions Sources/AsyncAlgorithms/Buffer/AsyncBufferSequence.swift
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ public struct AsyncBufferSequencePolicy: Sendable {

/// An `AsyncSequence` that buffers elements in regard to a policy.
public struct AsyncBufferSequence<Base: AsyncSequence & Sendable>: AsyncSequence {
enum StorageType<Base: AsyncSequence> {
enum StorageType {
case transparent(Base.AsyncIterator)
case bounded(storage: BoundedBufferStorage<Base>)
case unbounded(storage: UnboundedBufferStorage<Base>)
Expand All @@ -82,7 +82,7 @@ public struct AsyncBufferSequence<Base: AsyncSequence & Sendable>: AsyncSequence
let base: Base
let policy: AsyncBufferSequencePolicy

public init(
init(
base: Base,
policy: AsyncBufferSequencePolicy
) {
Expand All @@ -91,7 +91,7 @@ public struct AsyncBufferSequence<Base: AsyncSequence & Sendable>: AsyncSequence
}

public func makeAsyncIterator() -> Iterator {
let storageType: StorageType<Base>
let storageType: StorageType
switch self.policy.policy {
case .bounded(...0), .bufferingNewest(...0), .bufferingOldest(...0):
storageType = .transparent(self.base.makeAsyncIterator())
Expand All @@ -108,7 +108,7 @@ public struct AsyncBufferSequence<Base: AsyncSequence & Sendable>: AsyncSequence
}

public struct Iterator: AsyncIteratorProtocol {
var storageType: StorageType<Base>
var storageType: StorageType

public mutating func next() async rethrows -> Element? {
switch self.storageType {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public struct AsyncCombineLatest2Sequence<
let base1: Base1
let base2: Base2

public init(_ base1: Base1, _ base2: Base2) {
init(_ base1: Base1, _ base2: Base2) {
self.base1 = base1
self.base2 = base2
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public struct AsyncDebounceSequence<Base: AsyncSequence, C: Clock>: Sendable whe
/// - interval: The interval to debounce.
/// - tolerance: The tolerance of the clock.
/// - clock: The clock.
public init(_ base: Base, interval: C.Instant.Duration, tolerance: C.Instant.Duration?, clock: C) {
init(_ base: Base, interval: C.Instant.Duration, tolerance: C.Instant.Duration?, clock: C) {
self.base = base
self.interval = interval
self.tolerance = tolerance
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public struct AsyncInterspersedSequence<Base: AsyncSequence> {
internal let separator: Base.Element

@usableFromInline
internal init(_ base: Base, separator: Base.Element) {
init(_ base: Base, separator: Base.Element) {
self.base = base
self.separator = separator
}
Expand Down Expand Up @@ -73,7 +73,7 @@ extension AsyncInterspersedSequence: AsyncSequence {
internal var state = State.start

@usableFromInline
internal init(_ iterator: Base.AsyncIterator, separator: Base.Element) {
init(_ iterator: Base.AsyncIterator, separator: Base.Element) {
self.iterator = iterator
self.separator = separator
}
Expand Down
2 changes: 1 addition & 1 deletion Sources/AsyncAlgorithms/Merge/AsyncMerge2Sequence.swift
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public struct AsyncMerge2Sequence<
/// - Parameters:
/// - base1: The first upstream ``Swift/AsyncSequence``.
/// - base2: The second upstream ``Swift/AsyncSequence``.
public init(
init(
_ base1: Base1,
_ base2: Base2
) {
Expand Down
2 changes: 1 addition & 1 deletion Sources/AsyncAlgorithms/Merge/AsyncMerge3Sequence.swift
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public struct AsyncMerge3Sequence<
/// - base1: The first upstream ``Swift/AsyncSequence``.
/// - base2: The second upstream ``Swift/AsyncSequence``.
/// - base3: The third upstream ``Swift/AsyncSequence``.
public init(
init(
_ base1: Base1,
_ base2: Base2,
_ base3: Base3
Expand Down