Skip to content

Commit 09542e4

Browse files
committed
Fix String warnings.
1 parent ffffcd6 commit 09542e4

File tree

5 files changed

+7
-7
lines changed

5 files changed

+7
-7
lines changed

Sources/GraphQL/Error/SyntaxError.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ func highlightSourceAtLocation(source: Source, location: SourceLocation) -> Stri
2828
let prevLineNum = (line - 1).description
2929
let lineNum = line.description
3030
let nextLineNum = (line + 1).description
31-
let padLength = nextLineNum.characters.count
31+
let padLength = nextLineNum.count
3232

3333
let lines = splitLines(string: source.body)
3434

@@ -73,5 +73,5 @@ func splitLines(string: String) -> [String] {
7373
}
7474

7575
func leftpad(_ length: Int, _ string: String) -> String {
76-
return String(repeating: " ", count: max(length - string.characters.count + 1, 0)) + string
76+
return String(repeating: " ", count: max(length - string.count + 1, 0)) + string
7777
}

Sources/GraphQL/Map/MapCustomStringConvertible.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ extension Map {
3939
func escape(_ source: String) -> String {
4040
var string = "\""
4141

42-
for character in source.characters {
42+
for character in source {
4343
if let escapedSymbol = escapeMapping[character] {
4444
string.append(escapedSymbol)
4545
} else {

Sources/GraphQL/Utilities/ASTFromValue.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ func astFromValue(
111111

112112
// Use JSON stringify, which uses the same string encoding as GraphQL,
113113
// then remove the quotes.
114-
return StringValue(value: String(serialized.description.characters.dropFirst().dropLast()))
114+
return StringValue(value: String(serialized.description.dropFirst().dropLast()))
115115
}
116116

117117
throw GraphQLError(message: "Cannot convert value to AST: \(serialized)")

Tests/GraphQLTests/MapTests/MapTests.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -578,7 +578,7 @@ public class MapTests : XCTestCase {
578578
"string": "foo\nbar",
579579
]
580580

581-
XCTAssertEqual(buffer.debugDescription.characters.count, 465)
581+
XCTAssertEqual(buffer.debugDescription.count, 465)
582582
}
583583

584584

Tests/GraphQLTests/PersistedQueriesTests/PersistedQueriesTests.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ class PersistedQueriesTests: XCTestCase {
3030
let result = try lookup("parse_error")
3131
switch result {
3232
case .parseError(let error):
33-
XCTAssertEqual(String(error.message.characters.prefix(57)), "Syntax Error parse_error (1:4) Expected Name, found <EOF>")
33+
XCTAssertEqual(String(error.message.prefix(57)), "Syntax Error parse_error (1:4) Expected Name, found <EOF>")
3434
XCTAssertEqual(error.locations.first?.line, 1)
3535
XCTAssertEqual(error.locations.first?.column, 4)
3636
return
@@ -77,7 +77,7 @@ class PersistedQueriesTests: XCTestCase {
7777
do {
7878
_ = try graphql(queryRetrieval: self, queryId: "parse_error")
7979
} catch let error as GraphQLError {
80-
XCTAssertEqual(String(error.message.characters.prefix(57)), "Syntax Error parse_error (1:4) Expected Name, found <EOF>")
80+
XCTAssertEqual(String(error.message.prefix(57)), "Syntax Error parse_error (1:4) Expected Name, found <EOF>")
8181
XCTAssertEqual(error.locations.first?.line, 1)
8282
XCTAssertEqual(error.locations.first?.column, 4)
8383
}

0 commit comments

Comments
 (0)