File tree Expand file tree Collapse file tree 1 file changed +9
-6
lines changed Expand file tree Collapse file tree 1 file changed +9
-6
lines changed Original file line number Diff line number Diff line change @@ -1359,12 +1359,15 @@ extension Collection {
1359
1359
/// // Prints "10"
1360
1360
@_inlineable
1361
1361
public var first : Element ? {
1362
- // NB: Accessing `startIndex` may not be O(1) for some lazy collections,
1363
- // so instead of testing `isEmpty` and then returning the first element,
1364
- // we'll just rely on the fact that the iterator always yields the
1365
- // first element first.
1366
- var i = makeIterator ( )
1367
- return i. next ( )
1362
+ @inline ( __always)
1363
+ get {
1364
+ // NB: Accessing `startIndex` may not be O(1) for some lazy collections,
1365
+ // so instead of testing `isEmpty` and then returning the first element,
1366
+ // we'll just rely on the fact that the iterator always yields the
1367
+ // first element first.
1368
+ var i = makeIterator ( )
1369
+ return i. next ( )
1370
+ }
1368
1371
}
1369
1372
1370
1373
// TODO: swift-3-indexing-model - uncomment and replace above ready (or should we still use the iterator one?)
You can’t perform that action at this time.
0 commit comments