Skip to content

Commit 3aa43e8

Browse files
authored
Get rid of compilation warnings for let on newer Swift versions (#731)
1 parent 4cb1ff9 commit 3aa43e8

File tree

2 files changed

+7
-8
lines changed

2 files changed

+7
-8
lines changed

Sources/MongoSwift/MongoCollection+FindAndModify.swift

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -210,8 +210,7 @@ public struct FindOneAndDeleteOptions: FindAndModifyOptionsConvertible, Decodabl
210210
try FindAndModifyOptions(
211211
collation: self.collation,
212212
hint: self.hint,
213-
// swiftlint:disable:next colon
214-
`let`: self.let,
213+
letValue: self.let,
215214
maxTimeMS: self.maxTimeMS,
216215
projection: self.projection,
217216
remove: true,
@@ -278,8 +277,7 @@ public struct FindOneAndReplaceOptions: FindAndModifyOptionsConvertible, Decodab
278277
bypassDocumentValidation: self.bypassDocumentValidation,
279278
collation: self.collation,
280279
hint: self.hint,
281-
// swiftlint:disable:next colon
282-
`let`: self.let,
280+
letValue: self.let,
283281
maxTimeMS: self.maxTimeMS,
284282
projection: self.projection,
285283
returnDocument: self.returnDocument,
@@ -357,8 +355,7 @@ public struct FindOneAndUpdateOptions: FindAndModifyOptionsConvertible, Decodabl
357355
bypassDocumentValidation: self.bypassDocumentValidation,
358356
collation: self.collation,
359357
hint: self.hint,
360-
// swiftlint:disable:next colon
361-
`let`: self.let,
358+
letValue: self.let,
362359
maxTimeMS: self.maxTimeMS,
363360
projection: self.projection,
364361
returnDocument: self.returnDocument,

Sources/MongoSwift/Operations/FindAndModifyOperation.swift

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,15 @@ internal class FindAndModifyOptions {
1717
/// Initializes a new `FindAndModifyOptions` with the given settings.
1818
///
1919
/// - Throws: `MongoError.InvalidArgumentError` if any of the options are invalid.
20+
/// We use `letValue` rather than `let` for the parameter label because older Swift versions require escaping `let`
21+
// in argument lists, but newer ones do not, and will generate compiler warnings if the label is escaped.
2022
// swiftlint:disable:next cyclomatic_complexity
2123
internal init(
2224
arrayFilters: [BSONDocument]? = nil,
2325
bypassDocumentValidation: Bool? = nil,
2426
collation: BSONDocument?,
2527
hint: IndexHint? = nil,
26-
`let`: BSONDocument? = nil,
28+
letValue: BSONDocument? = nil,
2729
maxTimeMS: Int?,
2830
projection: BSONDocument?,
2931
remove: Bool? = nil,
@@ -89,7 +91,7 @@ internal class FindAndModifyOptions {
8991
case let .indexSpec(doc): extra["hint"] = .document(doc)
9092
}
9193
}
92-
if let lt = `let` {
94+
if let lt = letValue {
9395
extra["let"] = .document(lt)
9496
}
9597

0 commit comments

Comments
 (0)