rust/tests/ui/from_iter_instead_of_collect.rs
2020-11-03 16:44:21 +01:00

12 lines
280 B
Rust

#![warn(clippy::from_iter_instead_of_collect)]
use std::collections::HashMap;
use std::iter::FromIterator;
fn main() {
let iter_expr = std::iter::repeat(5).take(5);
Vec::from_iter(iter_expr);
HashMap::<usize, &i8>::from_iter(vec![5, 5, 5, 5].iter().enumerate());
}