diff options
| author | bors <bors@rust-lang.org> | 2014-10-22 14:32:11 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2014-10-22 14:32:11 +0000 |
| commit | 1d647564b1e575b3ca1e56aee33e3376a8e43772 (patch) | |
| tree | ecc6a886a3a51edf9fe9feb17e90072d731c15f1 | |
| parent | d44ea720fa9dfe062ef06d0eb49a58d4e7e92344 (diff) | |
| parent | 88cf0b92dd99956fb9ca626f2a7480666bce8fa8 (diff) | |
| download | rust-1d647564b1e575b3ca1e56aee33e3376a8e43772.tar.gz rust-1d647564b1e575b3ca1e56aee33e3376a8e43772.zip | |
auto merge of #18230 : cakebaker/rust/adapt_range_value_to_variable_name, r=steveklabnik
The variable name <code>one_to_one_hundred</code> implies that it will contain a collection with the values from 1 to 100, but the collection contains the values from 0 to 99. This patch changes the ranges to produce a collection with the values from 1 to 100.
| -rw-r--r-- | src/doc/guide.md | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/doc/guide.md b/src/doc/guide.md index 7a12ee98f44..81470a93e4c 100644 --- a/src/doc/guide.md +++ b/src/doc/guide.md @@ -4326,7 +4326,7 @@ The most common consumer is `collect()`. This code doesn't quite compile, but it shows the intention: ```{rust,ignore} -let one_to_one_hundred = range(0i, 100i).collect(); +let one_to_one_hundred = range(1i, 101i).collect(); ``` As you can see, we call `collect()` on our iterator. `collect()` takes @@ -4336,7 +4336,7 @@ type of things you want to collect, and so you need to let it know. Here's the version that does compile: ```{rust} -let one_to_one_hundred = range(0i, 100i).collect::<Vec<int>>(); +let one_to_one_hundred = range(1i, 101i).collect::<Vec<int>>(); ``` If you remember, the `::<>` syntax allows us to give a type hint, |
