Files
Fabian Fett ae1b32d0a9 Fix new NoUseUnstructuredThrowingTask warnings (#3733)
### Motivation

The new `NoUseUnstructuredThrowingTask` diagnostic on nightly-main flags
every `Task { try await ... }`
whose result is dropped. We have a few of those.

### Changes

- Use `async let _` instead of a fire-and-forget `Task` in
`NIOAsyncWriterTests` and
`NIOThrowingAsyncSequenceTests`.
- `NIOPerformanceTester`: rethrow the error from the `Task` in
`measureAndPrint` instead of
swallowing it.
- Name the `swift-nio` dependency explicitly in
`Benchmarks/Package.swift`; SwiftPM otherwise infers
it from the directory name, which breaks in git worktrees.

### Result

No warnings. Suspended yields in the tests are cancelled when the test
returns instead of leaking
past it, and async benchmarks fail loudly.
2026-09-04 09:28:30 +01:00

44 lines
1.5 KiB
Swift

// swift-tools-version:6.1
import PackageDescription
let package = Package(
name: "benchmarks",
platforms: [
.macOS("14")
],
dependencies: [
// The name is set explicitly: otherwise SwiftPM infers it from the directory name of the
// checkout, which breaks in git worktrees (where the directory is named after the worktree).
.package(name: "swift-nio", path: "../"),
.package(url: "https://github.com/ordo-one/package-benchmark.git", from: "1.29.11"),
],
targets: [
.executableTarget(
name: "NIOPosixBenchmarks",
dependencies: [
.product(name: "Benchmark", package: "package-benchmark"),
.product(name: "NIOCore", package: "swift-nio"),
.product(name: "NIOPosix", package: "swift-nio"),
],
path: "Benchmarks/NIOPosixBenchmarks",
swiftSettings: [.swiftLanguageMode(.v5)],
plugins: [
.plugin(name: "BenchmarkPlugin", package: "package-benchmark")
]
),
.executableTarget(
name: "NIOCoreBenchmarks",
dependencies: [
.product(name: "Benchmark", package: "package-benchmark"),
.product(name: "NIOCore", package: "swift-nio"),
.product(name: "NIOEmbedded", package: "swift-nio"),
],
path: "Benchmarks/NIOCoreBenchmarks",
plugins: [
.plugin(name: "BenchmarkPlugin", package: "package-benchmark")
]
),
]
)