Skip to content
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

.into_iter() doesn't work #10

Closed
tomaka opened this issue Jun 30, 2015 · 0 comments
Closed

.into_iter() doesn't work #10

tomaka opened this issue Jun 30, 2015 · 0 comments

Comments

@tomaka
Copy link
Contributor

@tomaka tomaka commented Jun 30, 2015

The following code:

extern crate smallvec;

fn main() {
    let mut vec: smallvec::SmallVec<[u8; 8]> = smallvec::SmallVec::new();

    vec.push(5);

    println!("{:?}", vec.len());

    for num in vec.into_iter() {
        println!("{:?}", num);
    }
}

Prints:

1

Expected:

1
5

This is probably because into_iter() sets the length to 0, and then only calls iter_mut(), therefore getting an iterator of length 0.

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

Successfully merging a pull request may close this issue.

None yet
1 participant
You can’t perform that action at this time.