Skip to content

unnecessary_unwrap not produced in 1.76 #12295

@Miha-Rozina

Description

@Miha-Rozina

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: Clippy is not doing the correct thingI-false-negativeIssue: The lint should have been triggered on code, but wasn't

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions