-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Remove use of range() in iterator docs. #22296
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
r? @pcwalton (rust_highfive has picked a reviewer for you, use r? to override) |
|
||
```{rust} | ||
```rust | ||
let nums = vec![1, 2, 3]; | ||
|
||
for i in range(0, nums.len()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
range
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lol and others, fixed them too
a1a36ab
to
bc7c907
Compare
@@ -4,20 +4,20 @@ Let's talk about loops. | |||
|
|||
Remember Rust's `for` loop? Here's an example: | |||
|
|||
```{rust} | |||
for x in range(0, 10) { | |||
``` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This rust
disappeared :(
bc7c907
to
debecf4
Compare
```{rust} | ||
let sum = range(1, 4) | ||
```rust | ||
let sum = 1..4 | ||
.fold(0, |sum, x| sum + x); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Parentheses needed around (1..4) here, else it is 1..(4.fold(---))
debecf4
to
817f3a4
Compare
Feedback addressed. @gankro r? |
@bors r+ 817f3 rollup |
Fixes #21577.