Skip to content

Iterator documentation uses an array when it probably meant to use a vec #24977

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

Closed
bstrie opened this issue Apr 30, 2015 · 2 comments · Fixed by #24994
Closed

Iterator documentation uses an array when it probably meant to use a vec #24977

bstrie opened this issue Apr 30, 2015 · 2 comments · Fixed by #24994

Comments

@bstrie
Copy link
Contributor

bstrie commented Apr 30, 2015

http://doc.rust-lang.org/1.0.0-beta.3/book/iterators.html#iterators

See the third code block:

let nums = [1, 2, 3];

for num in nums.iter() {
   println!("{}", num);
}

Up to this point this chapter has used vec![] instead of [] exclusively, and even the paragraph above this code refers to "vectors". This has led to some confusion over whether [] creates a vector, which is probably not an explanation fit for this section.

@bstrie bstrie added the A-docs label Apr 30, 2015
@pnkfelix
Copy link
Member

doesn't the documentation also try to present semi-idiomatic rust, though? Creating a vec! when a static array would suffice will just get people filing bugs against that, right?

@bluss
Copy link
Member

bluss commented Apr 30, 2015

Further down it uses .step_by which is unstable.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants