rust-clippy/tests/ui/explicit_into_iter_fn_arg.fixed
2023-05-24 15:59:12 +02:00

24 lines
493 B
Rust

//@run-rustfix
#![allow(unused)]
#![warn(clippy::explicit_into_iter_fn_arg)]
fn a<T>(_: T) {}
fn b<T: IntoIterator<Item = i32>>(_: T) {}
fn c(_: impl IntoIterator<Item = i32>) {}
fn d<T>(_: T)
where
T: IntoIterator<Item = i32>,
{
}
fn e<T: IntoIterator<Item = i32>>(_: T) {}
fn f(_: std::vec::IntoIter<i32>) {}
fn main() {
a(vec![1, 2].into_iter());
b(vec![1, 2]);
c(vec![1, 2]);
d(vec![1, 2]);
e([&1, &2, &3].into_iter().cloned());
f(vec![1, 2].into_iter());
}