]> git.lizzy.rs Git - rust.git/commitdiff
doc/core: fix description of `nth` function
authorVincent Bernat <vincent@bernat.im>
Sat, 8 Aug 2015 23:04:59 +0000 (01:04 +0200)
committerVincent Bernat <vincent@bernat.im>
Sat, 8 Aug 2015 23:04:59 +0000 (01:04 +0200)
The "nth" element can be confusing. In an array context, we know indexes
start from 0 but one may believe this is not the case with "nth". For
example, would `.nth(1)` return the first (1th/1st) or the second
element?  Rephrase a bit to be less confusing.

src/libcore/iter.rs

index 2968d63454457bc0d03003e833cd29ea18bfb030..3382095b4560f3b21e92d22ca973757969ce6226 100644 (file)
@@ -148,8 +148,7 @@ fn last(self) -> Option<Self::Item> where Self: Sized {
         last
     }
 
-    /// Loops through `n` iterations, returning the `n`th element of the
-    /// iterator.
+    /// Skips the `n` first elements of the iterator and returns the next one.
     ///
     /// # Examples
     ///