Skip to content

Commit 82f1c59

Browse files
authored
resolve warnings frmo deprecation in TSC (#3337)
motivation: no warnings, happy delelopers changes: remove left over code referring to TSC argument parser and Downloader which are both deprecated and not in use
1 parent a408582 commit 82f1c59

File tree

6 files changed

+4
-18
lines changed

6 files changed

+4
-18
lines changed

Sources/Basics/ConcurrencyHelpers.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ public final class ThreadSafeBox<Value> {
194194

195195
public enum Concurrency {
196196
public static var maxOperations: Int {
197-
return (try? ProcessEnv.vars["SWIFTPM_MAX_CONCURRENT_OPERATIONS"].map(Int.init)) ?? ProcessInfo.processInfo.activeProcessorCount
197+
return ProcessEnv.vars["SWIFTPM_MAX_CONCURRENT_OPERATIONS"].flatMap(Int.init) ?? ProcessInfo.processInfo.activeProcessorCount
198198
}
199199
}
200200

Sources/Commands/Error.swift

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,6 @@ func handle(error: Swift.Error) {
4141
switch error {
4242
case Diagnostics.fatalError:
4343
break
44-
45-
case ArgumentParserError.expectedArguments(let parser, _):
46-
print(error: error)
47-
parser.printUsage(on: stderrStream)
48-
4944
default:
5045
print(error: error)
5146
}

Sources/Commands/Options.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ public extension Sanitizer {
102102
return
103103
}
104104

105-
throw ArgumentConversionError.custom("valid sanitizers: \(Sanitizer.formattedValues)")
105+
throw StringError("valid sanitizers: \(Sanitizer.formattedValues)")
106106
}
107107

108108
/// All sanitizer options in a comma separated string

Sources/SPMBuildCore/Sanitizers.swift

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -69,12 +69,3 @@ public struct EnabledSanitizers: Encodable {
6969
try container.encode(sanitizers.sorted{ $0.rawValue < $1.rawValue }, forKey: .sanitizers)
7070
}
7171
}
72-
73-
extension Sanitizer: StringEnumArgument {
74-
public static let completion: ShellCompletion = .values([
75-
(address.rawValue, "enable Address sanitizer"),
76-
(thread.rawValue, "enable Thread sanitizer"),
77-
(undefined.rawValue, "enable Undefined Behavior sanitizer"),
78-
(scudo.rawValue, "enable Scudo hardened allocator")
79-
])
80-
}

Tests/CommandsTests/BuildToolTests.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ final class BuildToolTests: XCTestCase {
6565
do {
6666
_ = try Sanitizer(argument: "invalid")
6767
XCTFail("Should have failed to create Sanitizer")
68-
} catch let error as ArgumentConversionError {
68+
} catch let error as StringError {
6969
XCTAssertEqual(
7070
error.description, "valid sanitizers: address, thread, undefined, scudo")
7171
}

Tests/WorkspaceTests/WorkspaceTests.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5507,7 +5507,7 @@ final class WorkspaceTests: XCTestCase {
55075507
}
55085508
completion(.success(.okay(body: contents)))
55095509
} catch {
5510-
completion(.failure( DownloaderError.clientError(error)))
5510+
completion(.failure(error))
55115511
}
55125512
})
55135513

0 commit comments

Comments
 (0)