Skip to content

Commit 1ae7acd

Browse files
committed
#23: PR Feedback
1 parent 8c98e2d commit 1ae7acd

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

Sources/SafeCollectionAccess/Safe Collection Access.swift

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -176,9 +176,7 @@ public extension BidirectionalCollection {
176176

177177
/// Returns the position immediately after the given index, or `nil` if there is none.
178178
///
179-
/// The successor of an index must be well defined. For an index `i` into an immutable
180-
/// collection `c`, calling `c.index(after: i)` returns the same index every
181-
/// time.
179+
/// The successor of an index must be well defined. For an index `i` into an immutable collection `c`, calling `c.index(after: i)` returns the same index every time.
182180
///
183181
/// - Parameter i: An index of the collection.
184182
/// - Returns: The index value immediately after `i`, or `nil` if such an index wouldn't be in the collection.
@@ -190,7 +188,8 @@ public extension BidirectionalCollection {
190188

191189
/// Replaces the given index with its successor, or `nil` if there is none.
192190
///
193-
/// `i` is set to `nil` if the resulting index wouldn't be in the collection.
191+
/// If you pass `nil` for `i`, this returns immediately because there's nothing after nothing.
192+
/// If the resulting index wouldn't be in the collection, then `i` is set to `nil`.
194193
///
195194
/// - Parameter i: An index of the collection.
196195
func formIndexOrNil(after i: inout Index?) {
@@ -211,7 +210,8 @@ public extension BidirectionalCollection {
211210

212211
/// Replaces the given index with its predecessor, or `nil` if there is none.
213212
///
214-
/// `i` is set to `nil` if the resulting index wouldn't be in the collection.
213+
/// If you pass `nil` for `i`, this returns immediately because there's nothing before nothing.
214+
/// If the resulting index wouldn't be in the collection, then `i` is set to `nil`.
215215
///
216216
/// - Parameter i: An index of the collection.
217217
func formIndexOrNil(before i: inout Index?) {
@@ -224,7 +224,9 @@ public extension BidirectionalCollection {
224224
///
225225
/// - Parameters:
226226
/// - i: A valid index of the collection.
227-
/// - distance: The distance to offset `i`. `distance` must not be negative unless the collection conforms to the `BidirectionalCollection` protocol.
227+
/// - distance: The distance to offset `i`.
228+
/// `distance` may be negative.
229+
///
228230
/// - Returns: An index offset by `distance` from the index `i`.
229231
/// If `distance` is positive, this is the same value as the result of `distance` calls to `index(after:)`.
230232
/// If `distance` is negative, this is the same value as the result of `abs(distance)` calls to `index(before:)`.

0 commit comments

Comments
 (0)