Skip to content

Commit fa76278

Browse files
natecook1000airspeedswift
authored andcommitted
[stdlib] Remove redundant joined() methods (#14590)
* [stdlib] Improve FlattenCollection.Index hashValue * [stdlib] Remove redundant joined() methods
1 parent 8a7e652 commit fa76278

File tree

1 file changed

+1
-40
lines changed

1 file changed

+1
-40
lines changed

stdlib/public/core/Flatten.swift

Lines changed: 1 addition & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ extension FlattenCollection.Index : Comparable {
233233
extension FlattenCollection.Index : Hashable
234234
where Base.Index : Hashable, Base.Element.Index : Hashable {
235235
public var hashValue: Int {
236-
return _mixInt(_inner?.hashValue ?? 0) ^ _outer.hashValue
236+
return _combineHashValues(_inner?.hashValue ?? 0, _outer.hashValue)
237237
}
238238
}
239239

@@ -517,36 +517,6 @@ extension Collection where Element : Collection {
517517
}
518518
}
519519

520-
extension BidirectionalCollection where Element : BidirectionalCollection {
521-
/// Returns the elements of this collection of collections, concatenated.
522-
///
523-
/// In this example, an array of three ranges is flattened so that the
524-
/// elements of each range can be iterated in turn.
525-
///
526-
/// let ranges = [0..<3, 8..<10, 15..<17]
527-
///
528-
/// // A for-in loop over 'ranges' accesses each range:
529-
/// for range in ranges {
530-
/// print(range)
531-
/// }
532-
/// // Prints "0..<3"
533-
/// // Prints "8..<10"
534-
/// // Prints "15..<17"
535-
///
536-
/// // Use 'joined()' to access each element of each range:
537-
/// for index in ranges.joined() {
538-
/// print(index, terminator: " ")
539-
/// }
540-
/// // Prints: "0 1 2 8 9 15 16"
541-
///
542-
/// - Returns: A flattened view of the elements of this
543-
/// collection of collections.
544-
@_inlineable // FIXME(sil-serialize-all)
545-
public func joined() -> FlattenCollection<Self> {
546-
return FlattenCollection(self)
547-
}
548-
}
549-
550520
extension LazyCollectionProtocol
551521
where Self : Collection, Element : Collection {
552522
/// A concatenation of the elements of `self`.
@@ -556,15 +526,6 @@ extension LazyCollectionProtocol
556526
}
557527
}
558528

559-
extension LazyCollectionProtocol
560-
where Self : BidirectionalCollection, Element : BidirectionalCollection {
561-
/// A concatenation of the elements of `self`.
562-
@_inlineable // FIXME(sil-serialize-all)
563-
public func joined() -> LazyCollection<FlattenCollection<Elements>> {
564-
return FlattenCollection(elements).lazy
565-
}
566-
}
567-
568529
// @available(*, deprecated, renamed: "FlattenCollection.Index")
569530
public typealias FlattenCollectionIndex<T> = FlattenCollection<T>.Index where T : Collection, T.Element : Collection
570531
@available(*, deprecated, renamed: "FlattenCollection.Index")

0 commit comments

Comments
 (0)