about summary refs log tree commit diff
path: root/src/tools/clippy/tests/ui/crashes/ice-11230.fixed
blob: c49a419f0d4babfce6b6386b1e99d170f3b0f56c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
// Test for https://github.com/rust-lang/rust-clippy/issues/11230
#![warn(clippy::explicit_iter_loop)]
#![warn(clippy::needless_collect)]

// explicit_iter_loop
fn main() {
    const A: &[for<'a> fn(&'a ())] = &[];
    for v in A {}
    //~^ explicit_iter_loop
}

// needless_collect
trait Helper<'a>: Iterator<Item = fn()> {}

// Should not be linted because we have no idea whether the iterator has side effects
fn x(w: &mut dyn for<'a> Helper<'a>) {
    w.collect::<Vec<_>>().is_empty();
}