]> git.lizzy.rs Git - rust.git/blob - src/tools/clippy/tests/ui/result_unit_error.rs
Rollup merge of #76718 - poliorcetics:vec-ui-to-unit-test, r=jyn514
[rust.git] / src / tools / clippy / tests / ui / result_unit_error.rs
1 #[warn(clippy::result_unit_err)]
2 #[allow(unused)]
3
4 pub fn returns_unit_error() -> Result<u32, ()> {
5     Err(())
6 }
7
8 fn private_unit_errors() -> Result<String, ()> {
9     Err(())
10 }
11
12 pub trait HasUnitError {
13     fn get_that_error(&self) -> Result<bool, ()>;
14
15     fn get_this_one_too(&self) -> Result<bool, ()> {
16         Err(())
17     }
18 }
19
20 impl HasUnitError for () {
21     fn get_that_error(&self) -> Result<bool, ()> {
22         Ok(true)
23     }
24 }
25
26 trait PrivateUnitError {
27     fn no_problem(&self) -> Result<usize, ()>;
28 }
29
30 pub struct UnitErrorHolder;
31
32 impl UnitErrorHolder {
33     pub fn unit_error(&self) -> Result<usize, ()> {
34         Ok(0)
35     }
36 }
37
38 fn main() {}