Skip to content

missing-unsafe false positive #14360

Closed
@DaniPopes

Description

@DaniPopes

rust-analyzer version: 0.4.1436-standalone

rustc version: rustc 1.70.0-nightly (8a73f50d8 2023-03-11)

relevant settings: N/A

rust-analyzer triggers a missing-unsafe lint false positive when in an if condition expression and preceded by an attribute

Example:

unsafe fn unsafe_fn() -> bool {
    false
}

fn main() -> Result<()> {
    #[allow(unused)] // any attr
    if unsafe { unsafe_fn() } {}
    // ^ rust-analyzer(missing-unsafe)
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions