Skip to content

catch transmuting references which could be pointer casts #2064

Closed
@oli-obk

Description

@oli-obk
pub unsafe fn from_utf8_unchecked(v: &[u8]) -> &str {
    std::mem::transmute(v)
}

is an example from libcore that isn't caught by clippy. It has been fixed in libcore, but it would be nice if we caught handwritten impls of similar things

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-lintArea: New lintsE-mediumCall for participation: Medium difficulty level problem and requires some initial experience.L-unnecessaryLint: Warn about unnecessary codeT-middleType: Probably requires verifiying types

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions