]> git.lizzy.rs Git - rust.git/blob - src/tools/clippy/tests/ui/unnecessary_lazy_eval_unfixable.rs
Rollup merge of #105602 - RalfJung:read-convenience, r=oli-obk
[rust.git] / src / tools / clippy / tests / ui / unnecessary_lazy_eval_unfixable.rs
1 #![warn(clippy::unnecessary_lazy_evaluations)]
2
3 struct Deep(Option<usize>);
4
5 #[derive(Copy, Clone)]
6 struct SomeStruct {
7     some_field: usize,
8 }
9
10 fn main() {
11     // fix will break type inference
12     let _ = Ok(1).unwrap_or_else(|()| 2);
13     mod e {
14         pub struct E;
15     }
16     let _ = Ok(1).unwrap_or_else(|e::E| 2);
17     let _ = Ok(1).unwrap_or_else(|SomeStruct { .. }| 2);
18
19     // Fix #6343
20     let arr = [(Some(1),)];
21     Some(&0).and_then(|&i| arr[i].0);
22 }