#![warn(clippy::from_iter_instead_of_collect)] #![allow(unused_imports, unused_tuple_struct_fields)] #![allow(clippy::useless_vec)] use std::collections::{BTreeMap, BTreeSet, HashMap, VecDeque}; struct Foo(Vec); impl FromIterator for Foo { fn from_iter>(_: T) -> Self { todo!() } } impl<'a> FromIterator<&'a bool> for Foo { fn from_iter>(iter: T) -> Self { iter.into_iter().copied().collect::() } } fn main() { let iter_expr = std::iter::repeat(5).take(5); let _ = iter_expr.collect::>(); let _ = vec![5, 5, 5, 5].iter().enumerate().collect::>(); Vec::from_iter(vec![42u32]); let a = vec![0, 1, 2]; assert_eq!(a, (0..3).collect::>()); assert_eq!(a, (0..3).collect::>()); let mut b = (0..3).collect::>(); b.push_back(4); let mut b = (0..3).collect::>(); b.push_back(4); { use std::collections; let mut b = (0..3).collect::>(); b.push_back(4); } let values = [(0, 'a'), (1, 'b'), (2, 'c'), (3, 'd')]; let bm = values.iter().cloned().collect::>(); let mut bar = bm.range(0..2).collect::>(); bar.insert(&4, &'e'); let mut bts = (0..3).collect::>(); bts.insert(2); { use std::collections; let _ = (0..3).collect::>(); let _ = (0..3).collect::>(); } for _i in [1, 2, 3].iter().collect::>() {} for _i in [1, 2, 3].iter().collect::>() {} }