Skip to content

Different behavior of the let_underscore_lock lint in rustc compared to clippy #102771

Closed
@kamulos

Description

@kamulos

I tried this code with the new rustc lint:

fn main() {
    let _ = std::sync::Mutex::new(()).lock();
}

Clippy warns here, but rustc doesn't. This might be intentional, but I think this could be a source of mistakes...

The rustc lint is triggered, as soon as I use .lock().unwrap()

Meta

rustc --version --verbose:

rustc 1.66.0-nightly (0ca356586 2022-10-06)
binary: rustc
commit-hash: 0ca356586fed56002b10920fd21ddf6fb12de797
commit-date: 2022-10-06
host: x86_64-unknown-linux-gnu
release: 1.66.0-nightly
LLVM version: 15.0.2

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-lintsArea: Lints (warnings about flaws in source code) such as unused_mut.C-bugCategory: This is a bug.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions