Skip to content

Commit 90f9d72

Browse files
author
Dave Abrahams
committed
first/contains(predicate) => first/contains(where: predicate)
1 parent f0348c4 commit 90f9d72

File tree

4 files changed

+8
-8
lines changed

4 files changed

+8
-8
lines changed

stdlib/public/core/FloatingPointParsing.swift.gyb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ extension ${Self} {
6666
let (result, n) = text.withCString(parseNTBS)
6767

6868
if n == 0 || n != u16.count
69-
|| u16.contains({ $0 > 127 || _isspace_clocale($0) }) {
69+
|| u16.contains(where: { $0 > 127 || _isspace_clocale($0) }) {
7070
return nil
7171
}
7272
self = result

stdlib/public/core/Sequence.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -564,12 +564,12 @@ public protocol Sequence {
564564
/// Returns the first element of the sequence that satisfies the given
565565
/// predicate or nil if no such element is found.
566566
///
567-
/// - Parameter where: A closure that takes an element of the
567+
/// - Parameter predicate: A closure that takes an element of the
568568
/// sequence as its argument and returns a Boolean value indicating
569569
/// whether the element is a match.
570570
/// - Returns: The first match or `nil` if there was no match.
571571
func first(
572-
where: @noescape (Iterator.Element) throws -> Bool
572+
where predicate: @noescape (Iterator.Element) throws -> Bool
573573
) rethrows -> Iterator.Element?
574574

575575
func _customContainsEquatableElement(
@@ -969,7 +969,7 @@ extension Sequence {
969969
/// Returns the first element of the sequence that satisfies the given
970970
/// predicate or nil if no such element is found.
971971
///
972-
/// - Parameter where: A closure that takes an element of the
972+
/// - Parameter predicate: A closure that takes an element of the
973973
/// sequence as its argument and returns a Boolean value indicating
974974
/// whether the element is a match.
975975
/// - Returns: The first match or `nil` if there was no match.

stdlib/public/core/SequenceAlgorithms.swift.gyb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -505,7 +505,7 @@ extension Sequence {
505505
/// - Returns: `true` if the sequence contains an element that satisfies
506506
/// `predicate`; otherwise, `false`.
507507
public func contains(
508-
_ predicate: @noescape (${GElement}) throws -> Bool
508+
where predicate: @noescape (${GElement}) throws -> Bool
509509
) rethrows -> Bool {
510510
for e in self {
511511
if try predicate(e) {

validation-test/stdlib/AtomicInt.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -725,7 +725,7 @@ struct AtomicInitializeARCRefRaceTest : RaceTestWithPerTrialData {
725725
_ raceData: RaceData, _ threadLocalData: inout ThreadLocalData
726726
) -> Observation {
727727
var observation = Observation4UInt(0, 0, 0, 0)
728-
var initializerDestroyed = HeapBool(false)
728+
let initializerDestroyed = HeapBool(false)
729729
do {
730730
let initializer = DummyObject(
731731
destroyedFlag: initializerDestroyed,
@@ -749,13 +749,13 @@ struct AtomicInitializeARCRefRaceTest : RaceTestWithPerTrialData {
749749
_ sink: (RaceTestObservationEvaluation) -> Void
750750
) {
751751
let ref = observations[0].data2
752-
if observations.contains({ $0.data2 != ref }) {
752+
if observations.contains(where: { $0.data2 != ref }) {
753753
for observation in observations {
754754
sink(.failureInteresting("mismatched reference, expected \(ref): \(observation)"))
755755
}
756756
return
757757
}
758-
if observations.contains({ $0.data3 != 0x12345678 }) {
758+
if observations.contains(where: { $0.data3 != 0x12345678 }) {
759759
for observation in observations {
760760
sink(.failureInteresting("wrong data: \(observation)"))
761761
}

0 commit comments

Comments
 (0)