mirror of
https://github.com/rust-lang/rust.git
synced 2024-12-14 01:25:54 +00:00
22 lines
493 B
Rust
22 lines
493 B
Rust
// run-rustfix
|
|
#![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();
|
|
}
|