Skip to content

False positive for use_self when using core::mem::transmute in From impl #4734

Closed
@IlyaSamokhin97

Description

@IlyaSamokhin97

clippy 0.0.212 (3aea860 2019-09-03)

#![warn(clippy::use_self)]

#[repr(C, packed)]
pub struct X {
    pub x: u32,
}

impl From<X> for u32 {
    fn from(c: X) -> Self {
        unsafe {
            core::mem::transmute(c)
        }
    }
}

playground link

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: Clippy is not doing the correct thingI-false-positiveIssue: The lint was triggered on code it shouldn't have

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions