rust-clippy/tests/ui/needless_option_as_deref.fixed

14 lines
288 B
Rust
Raw Normal View History

2021-08-24 14:06:46 +00:00
// run-rustfix
#[warn(clippy::needless_option_as_deref)]
fn main() {
// should lint
let _: Option<&usize> = Some(&1);
let _: Option<&mut usize> = Some(&mut 1);
// should not lint
let _ = Some(Box::new(1)).as_deref();
let _ = Some(Box::new(1)).as_deref_mut();
}