<!-- Hi there! Whether you've come to make a suggestion for a new lint, an improvement to an existing lint or to report a bug or a false positive in Clippy, you've come to the right place. For bug reports and false positives, please include the output of `cargo clippy -V` in the report. Thank you for using Clippy! Write your comment below this line: --> This code: ```rust if let Some(v) = optional { v == &"hello" } else { false } ``` could be optimized to ```rust optional.as_ref().map_or(false, |v| v == &"hello") ``` [[playground]](https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&code=%23!%5Bwarn(clippy%3A%3Aall)%5D%0A%0Afn%20is_hello(optional%3A%20%26Option%3C%26str%3E)%20-%3E%20bool%20%7B%0A%20%20%20%20if%20let%20Some(v)%20%3D%20optional%20%7B%0A%20%20%20%20%20%20%20%20v%20%3D%3D%20%26%22hello%22%0A%20%20%20%20%7D%20else%20%7B%0A%20%20%20%20%20%20%20%20false%0A%20%20%20%20%7D%0A%7D%0A%0Afn%20is_hello_opt(optional%3A%20%26Option%3C%26str%3E)%20-%3E%20bool%20%7B%0A%20%20%20%20optional.as_ref().map_or(false%2C%20%7Cv%7C%20v%20%3D%3D%20%26%22hello%22)%0A%7D%0A%0Afn%20main()%20%7B%0A%20%20%20%20let%20optional%20%3D%20Some(%22hello%22)%3B%0A%20%20%20%20dbg!(is_hello(%26optional))%3B%0A%20%20%20%20dbg!(is_hello_opt(%26optional))%3B%0A%7D)