]> git.lizzy.rs Git - rust.git/commitdiff
TRPL: minor correction on how `chars().nth()` work
authorVincent Bernat <vincent@bernat.im>
Sat, 8 Aug 2015 22:56:38 +0000 (00:56 +0200)
committerVincent Bernat <vincent@bernat.im>
Sat, 8 Aug 2015 22:56:38 +0000 (00:56 +0200)
The previous wording was confusing. While would we need to go through
the whole list just to find the first code point? `chars()` being an
iterator, we only need to walk from the beginning of the list.

src/doc/trpl/strings.md

index 7d5c43ea14c03cc6bace35702e5a67586b89c0d6..aa1944a099335842116c1472f0ff82ed8ec3bee3 100644 (file)
@@ -115,7 +115,7 @@ You can get something similar to an index like this:
 let dog = hachiko.chars().nth(1); // kinda like hachiko[1]
 ```
 
-This emphasizes that we have to go through the whole list of `chars`.
+This emphasizes that we have to walk from the beginning of the list of `chars`.
 
 ## Slicing