mirror of
https://github.com/rust-lang/rust.git
synced 2024-10-31 22:41:50 +00:00
23 lines
464 B
Rust
23 lines
464 B
Rust
#![warn(clippy::unnecessary_lazy_evaluations)]
|
|
|
|
struct Deep(Option<usize>);
|
|
|
|
#[derive(Copy, Clone)]
|
|
struct SomeStruct {
|
|
some_field: usize,
|
|
}
|
|
|
|
fn main() {
|
|
// fix will break type inference
|
|
let _ = Ok(1).unwrap_or_else(|()| 2);
|
|
mod e {
|
|
pub struct E;
|
|
}
|
|
let _ = Ok(1).unwrap_or_else(|e::E| 2);
|
|
let _ = Ok(1).unwrap_or_else(|SomeStruct { .. }| 2);
|
|
|
|
// Fix #6343
|
|
let arr = [(Some(1),)];
|
|
Some(&0).and_then(|&i| arr[i].0);
|
|
}
|