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