rust/tests/ui/needless_option_take.rs
infrandomness 262b35ea2c Introduce option_take_on_temporary lints
This lint checks if Option::take() is used on a temporary value (a value
that is not of type &mut Option and that is not a Place expression) to
suggest omitting take()
2022-04-14 12:41:47 +02:00

6 lines
116 B
Rust

fn main() {
println!("Testing option_take_on_temporary");
let x = Some(3);
let y = x.as_ref().take();
}