Skip to content

.into_iter() doesn't work #10

@tomaka

Description

@tomaka

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions