blob: 3298a222bda6a17b212a687e490fbffab36bfe1c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
#![warn(clippy::default_instead_of_iter_empty)]
#![allow(dead_code)]
use std::collections::HashMap;
#[derive(Default)]
struct Iter {
iter: std::iter::Empty<usize>,
}
fn main() {
// Do lint.
let _ = std::iter::empty::<usize>();
let _ = std::iter::empty::<HashMap<usize, usize>>();
let _foo: std::iter::Empty<usize> = std::iter::empty();
// Do not lint.
let _ = Vec::<usize>::default();
let _ = String::default();
let _ = Iter::default();
}
|