rust-clippy icon indicating copy to clipboard operation
rust-clippy copied to clipboard

unnecessary_unwrap not produced in 1.76

Open Miha-Rozina opened this issue 5 months ago • 1 comments

Summary

The following code doesn't produce a warning for the unnecessary_unwrap lint. It works as intended in Rust 1.73

Lint Name

unnecessary_unwrap

Reproducer

I tried this code:

fn foo(option: Option<String>) {
    if option.is_some() {
        println!("{}", option.unwrap());
    }
}

I expected to see this happen: To get the unnecessary_unwrap lint's warning.

Instead, this happened: No warnings emitted.

Version

rustc 1.76.0 (07dca489a 2024-02-04)
binary: rustc
commit-hash: 07dca489ac2d933c78d3c5158e3f43beefeb02ce
commit-date: 2024-02-04
host: aarch64-apple-darwin
release: 1.76.0
LLVM version: 17.0.6

Miha-Rozina avatar Feb 15 '24 09:02 Miha-Rozina