From e87e9ddd02ab8bc690570a4b13d0b7b749f34d20 Mon Sep 17 00:00:00 2001 From: Philippe Hausler Date: Thu, 17 Mar 2022 16:13:57 -0700 Subject: [PATCH] Reduce warnings for preconcurrency and non mutated vars (#88) --- Sources/AsyncAlgorithms/AsyncBufferSequence.swift | 2 +- Tests/AsyncAlgorithmsTests/TestBuffer.swift | 2 +- Tests/AsyncAlgorithmsTests/TestRemoveDuplicates.swift | 4 ++-- Tests/AsyncAlgorithmsTests/TestZip.swift | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Sources/AsyncAlgorithms/AsyncBufferSequence.swift b/Sources/AsyncAlgorithms/AsyncBufferSequence.swift index d6fb27e..3147824 100644 --- a/Sources/AsyncAlgorithms/AsyncBufferSequence.swift +++ b/Sources/AsyncAlgorithms/AsyncBufferSequence.swift @@ -78,7 +78,7 @@ actor AsyncBufferState { func terminate() { terminationState = .terminal - var oldPending = pending + let oldPending = pending pending = [] for continuation in oldPending { continuation.resume(returning: .success(nil)) diff --git a/Tests/AsyncAlgorithmsTests/TestBuffer.swift b/Tests/AsyncAlgorithmsTests/TestBuffer.swift index 57d9d26..d683820 100644 --- a/Tests/AsyncAlgorithmsTests/TestBuffer.swift +++ b/Tests/AsyncAlgorithmsTests/TestBuffer.swift @@ -9,7 +9,7 @@ // //===----------------------------------------------------------------------===// -import XCTest +@preconcurrency import XCTest import AsyncAlgorithms final class TestBuffer: XCTestCase { diff --git a/Tests/AsyncAlgorithmsTests/TestRemoveDuplicates.swift b/Tests/AsyncAlgorithmsTests/TestRemoveDuplicates.swift index 39029e5..eb859d0 100644 --- a/Tests/AsyncAlgorithmsTests/TestRemoveDuplicates.swift +++ b/Tests/AsyncAlgorithmsTests/TestRemoveDuplicates.swift @@ -9,7 +9,7 @@ // //===----------------------------------------------------------------------===// -import XCTest +@preconcurrency import XCTest import AsyncAlgorithms final class TestRemoveDuplicates: XCTestCase { @@ -64,7 +64,7 @@ final class TestRemoveDuplicates: XCTestCase { throw NSError(domain: NSCocoaErrorDomain, code: -1, userInfo: nil) } return $0 - } as (Int) throws -> Int) + } as @Sendable (Int) throws -> Int) do { for try await item in throwingSequence.removeDuplicates() { diff --git a/Tests/AsyncAlgorithmsTests/TestZip.swift b/Tests/AsyncAlgorithmsTests/TestZip.swift index e0a7955..b6343c1 100644 --- a/Tests/AsyncAlgorithmsTests/TestZip.swift +++ b/Tests/AsyncAlgorithmsTests/TestZip.swift @@ -9,7 +9,7 @@ // //===----------------------------------------------------------------------===// -import XCTest +@preconcurrency import XCTest import AsyncAlgorithms final class TestZip2: XCTestCase {