rust-clippy/tests/ui/from_iter_instead_of_collect.rs

14 lines
314 B
Rust
Raw Normal View History

#![warn(clippy::from_iter_instead_of_collect)]
use std::collections::HashMap;
use std::iter::FromIterator;
fn main() {
2020-10-01 16:04:05 +00:00
let iter_expr = std::iter::repeat(5).take(5);
Vec::from_iter(iter_expr);
2020-10-01 16:34:36 +00:00
2020-10-01 16:04:05 +00:00
HashMap::<usize, &i8>::from_iter(vec![5, 5, 5, 5].iter().enumerate());
Vec::from_iter(vec![42u32]);
}