]> git.lizzy.rs Git - rust.git/blob - tests/ui/unit_hash.rs
Don't lint `if_same_then_else` with `if let` conditions
[rust.git] / tests / ui / unit_hash.rs
1 #![warn(clippy::unit_hash)]
2
3 use std::collections::hash_map::DefaultHasher;
4 use std::hash::Hash;
5
6 enum Foo {
7     Empty,
8     WithValue(u8),
9 }
10
11 fn do_nothing() {}
12
13 fn main() {
14     let mut state = DefaultHasher::new();
15     let my_enum = Foo::Empty;
16
17     match my_enum {
18         Foo::Empty => ().hash(&mut state),
19         Foo::WithValue(x) => x.hash(&mut state),
20     }
21
22     let res = ();
23     res.hash(&mut state);
24
25     #[allow(clippy::unit_arg)]
26     do_nothing().hash(&mut state);
27 }