-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Closed
Labels
C-bugCategory: Clippy is not doing the correct thingCategory: Clippy is not doing the correct thing
Description
The following code causes clippy to trigger the infinite_iter
lint but it's perfectly fine since ArrayVec
only takes a limited amount (10 in this case) of items from the iterator (see ArrayVec documentation
use arrayvec::ArrayVec;
use std::iter;
fn main() {
let stuff: ArrayVec<[u8; 10]> = iter::repeat(22).collect();
println!("{:?}", stuff); // -> [22, 22, 22, 22, 22, 22, 22, 22, 22, 22]
}
Note that infinite_iter
is set to deny
by default, causing compilation to abort with an error.
Clippy version: clippy 0.0.212 (2e26fdc2 2018-11-22)
Metadata
Metadata
Assignees
Labels
C-bugCategory: Clippy is not doing the correct thingCategory: Clippy is not doing the correct thing