Skip to content

Commit 1115009

Browse files
committed
Get rid of array slice that was always for the full array
1 parent fb2a4bb commit 1115009

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

Sources/SwiftDriver/Driver/Driver.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,7 @@ public struct Driver {
241241
throw Error.subcommandPassedToDriver
242242
}
243243

244-
var args = try Self.expandResponseFiles(args, fileSystem: fileSystem, diagnosticsEngine: self.diagnosticEngine)[...]
244+
var args = try Self.expandResponseFiles(args, fileSystem: fileSystem, diagnosticsEngine: self.diagnosticEngine)
245245

246246
self.driverKind = try Self.determineDriverKind(args: &args)
247247
self.optionTable = OptionTable()
@@ -581,7 +581,7 @@ extension Driver {
581581
/// Determine the driver kind based on the command-line arguments, consuming the arguments
582582
/// conveying this information.
583583
public static func determineDriverKind(
584-
args: inout ArraySlice<String>
584+
args: inout [String]
585585
) throws -> DriverKind {
586586
// Get the basename of the driver executable.
587587
let execRelPath = args.removeFirst()

Tests/SwiftDriverTests/SwiftDriverTests.swift

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -58,21 +58,21 @@ final class SwiftDriverTests: XCTestCase {
5858
func assertArgs(
5959
_ args: String...,
6060
parseTo driverKind: DriverKind,
61-
leaving remainingArgs: ArraySlice<String>,
61+
leaving remainingArgs: [String],
6262
file: StaticString = #file, line: UInt = #line
6363
) throws {
64-
var slice = args[...]
65-
let result = try Driver.determineDriverKind(args: &slice)
64+
var args = args
65+
let result = try Driver.determineDriverKind(args: &args)
6666

6767
XCTAssertEqual(result, driverKind, file: file, line: line)
68-
XCTAssertEqual(slice, remainingArgs, file: file, line: line)
68+
XCTAssertEqual(args, remainingArgs, file: file, line: line)
6969
}
7070
func assertArgsThrow(
7171
_ args: String...,
7272
file: StaticString = #file, line: UInt = #line
7373
) throws {
74-
var slice = args[...]
75-
XCTAssertThrowsError(try Driver.determineDriverKind(args: &slice))
74+
var args = args
75+
XCTAssertThrowsError(try Driver.determineDriverKind(args: &args))
7676
}
7777

7878
try assertArgs("swift", parseTo: .interactive, leaving: [])

0 commit comments

Comments
 (0)