Skip to content

Users should be able to indicate allowed methods for unwrap_used #15944

@c410-f3r

Description

@c410-f3r

Mostly because of std::sync::Mutex but I am not aware of any other use-case. It is also possible to directly whitelist the lock method in the lint without any user-provided data.

use std::sync::Mutex;

#[deny(clippy::unwrap_used)]
pub fn from_days(mutex: &Mutex<i32>) -> i32 {
    *mutex.lock().unwrap()
}
allowed-unwrap-used-functions = ["std::sync::Mutex::lock"]

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions