Skip to content

Commit 108c975

Browse files
committed
Let compiler to infer the type
1 parent 429a65e commit 108c975

File tree

4 files changed

+33
-33
lines changed

4 files changed

+33
-33
lines changed

Sources/LinuxPlatform/Linux.swift

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,15 @@ var swiftGPGKeysRefreshed = false
77
/// This implementation can be reused for any supported Linux platform.
88
/// TODO: replace dummy implementations
99
public struct Linux: Platform {
10-
let linuxPlatforms = [
11-
PlatformDefinition.ubuntu2404,
12-
PlatformDefinition.ubuntu2204,
13-
PlatformDefinition.ubuntu2004,
14-
PlatformDefinition.ubuntu1804,
15-
PlatformDefinition.fedora39,
16-
PlatformDefinition.rhel9,
17-
PlatformDefinition.amazonlinux2,
18-
PlatformDefinition.debian12,
10+
let linuxPlatforms: [PlatformDefinition] = [
11+
.ubuntu2404,
12+
.ubuntu2204,
13+
.ubuntu2004,
14+
.ubuntu1804,
15+
.fedora39,
16+
.rhel9,
17+
.amazonlinux2,
18+
.debian12,
1919
]
2020

2121
public init() {}
@@ -510,7 +510,7 @@ public struct Linux: Platform {
510510
return await self.manualSelectPlatform(platformPretty)
511511
}
512512

513-
return PlatformDefinition.amazonlinux2
513+
return .amazonlinux2
514514
} else if (id + (idlike ?? "")).contains("rhel") {
515515
guard versionID.hasPrefix("9") else {
516516
let message = "Unsupported version of RHEL"
@@ -522,7 +522,7 @@ public struct Linux: Platform {
522522
return await self.manualSelectPlatform(platformPretty)
523523
}
524524

525-
return PlatformDefinition.rhel9
525+
return .rhel9
526526
} else if let pd = [PlatformDefinition.ubuntu1804, .ubuntu2004, .ubuntu2204, .ubuntu2404, .debian12, .fedora39].first(where: { $0.name == id + versionID }) {
527527
return pd
528528
}

Sources/MacOSPlatform/MacOS.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ public struct MacOS: Platform {
156156

157157
public func detectPlatform(disableConfirmation _: Bool, platform _: String?) async -> PlatformDefinition {
158158
// No special detection required on macOS platform
159-
PlatformDefinition.macOS
159+
.macOS
160160
}
161161

162162
public func getShell() async throws -> String {

Tests/SwiftlyTests/HTTPClientTests.swift

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -51,27 +51,27 @@ final class HTTPClientTests: SwiftlyTests {
5151
}
5252

5353
func testGetToolchainMetdataFromSwiftOrg() async throws {
54-
let supportedPlatforms = [
55-
PlatformDefinition.macOS,
56-
PlatformDefinition.ubuntu2404,
57-
PlatformDefinition.ubuntu2204,
58-
PlatformDefinition.ubuntu2004,
59-
// PlatformDefinition.ubuntu1804, // There are no releases for Ubuntu 18.04 in the branches being tested below
60-
PlatformDefinition.rhel9,
61-
PlatformDefinition.fedora39,
62-
PlatformDefinition.amazonlinux2,
63-
PlatformDefinition.debian12,
54+
let supportedPlatforms: [PlatformDefinition] = [
55+
.macOS,
56+
.ubuntu2404,
57+
.ubuntu2204,
58+
.ubuntu2004,
59+
// .ubuntu1804, // There are no releases for Ubuntu 18.04 in the branches being tested below
60+
.rhel9,
61+
.fedora39,
62+
.amazonlinux2,
63+
.debian12,
6464
]
6565

66-
let newPlatforms = [
67-
PlatformDefinition.ubuntu2404,
68-
PlatformDefinition.fedora39,
69-
PlatformDefinition.debian12,
66+
let newPlatforms: [PlatformDefinition] = [
67+
.ubuntu2404,
68+
.fedora39,
69+
.debian12,
7070
]
7171

72-
let branches = [
73-
ToolchainVersion.Snapshot.Branch.main,
74-
ToolchainVersion.Snapshot.Branch.release(major: 6, minor: 0), // This is available in swift.org API
72+
let branches: [ToolchainVersion.Snapshot.Branch] = [
73+
.main,
74+
.release(major: 6, minor: 0), // This is available in swift.org API
7575
]
7676

7777
for arch in ["x86_64", "aarch64"] {

Tests/SwiftlyTests/SwiftlyTests.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -331,10 +331,10 @@ class SwiftlyTests: XCTestCase {
331331

332332
// Snapshots are currently unavailable for these platforms on swift.org
333333
// TODO: remove these once snapshots are available for them
334-
let snapshotsUnavailable = [
335-
PlatformDefinition.ubuntu2404,
336-
PlatformDefinition.fedora39,
337-
PlatformDefinition.debian12,
334+
let snapshotsUnavailable: [PlatformDefinition] = [
335+
.ubuntu2404,
336+
.fedora39,
337+
.debian12,
338338
]
339339

340340
return !snapshotsUnavailable.contains(pd)

0 commit comments

Comments
 (0)