Skip to content

Commit f510d93

Browse files
author
Dave Abrahams
committed
first(predicate) => first(where: predicate); contains(predicate) => contains(elementWhere: predicate)
1 parent f5076f4 commit f510d93

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(invoke: parseNTBS)
6767

6868
if n == 0 || n != u16.count
69-
|| u16.contains({ $0 > 127 || _isspace_clocale($0) }) {
69+
|| u16.contains(elementWhere: { $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
@@ -561,12 +561,12 @@ public protocol Sequence {
561561
/// Returns the first element of the sequence that satisfies the given
562562
/// predicate or nil if no such element is found.
563563
///
564-
/// - Parameter where: A closure that takes an element of the
564+
/// - Parameter predicate: A closure that takes an element of the
565565
/// sequence as its argument and returns a Boolean value indicating
566566
/// whether the element is a match.
567567
/// - Returns: The first match or `nil` if there was no match.
568568
func first(
569-
where: @noescape (Iterator.Element) throws -> Bool
569+
where predicate: @noescape (Iterator.Element) throws -> Bool
570570
) rethrows -> Iterator.Element?
571571

572572
func _customContainsEquatableElement(
@@ -966,7 +966,7 @@ extension Sequence {
966966
/// Returns the first element of the sequence that satisfies the given
967967
/// predicate or nil if no such element is found.
968968
///
969-
/// - Parameter where: A closure that takes an element of the
969+
/// - Parameter predicate: A closure that takes an element of the
970970
/// sequence as its argument and returns a Boolean value indicating
971971
/// whether the element is a match.
972972
/// - 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
@@ -503,7 +503,7 @@ extension Sequence {
503503
/// - Returns: `true` if the sequence contains an element that satisfies
504504
/// `predicate`; otherwise, `false`.
505505
public func contains(
506-
_ predicate: @noescape (${GElement}) throws -> Bool
506+
elementWhere predicate: @noescape (${GElement}) throws -> Bool
507507
) rethrows -> Bool {
508508
for e in self {
509509
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(elementWhere: { $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(elementWhere: { $0.data3 != 0x12345678 }) {
759759
for observation in observations {
760760
sink(.failureInteresting("wrong data: \(observation)"))
761761
}

0 commit comments

Comments
 (0)