check_unnecessary_transmute in rustc_lint::transmute - Rust
Description: Check for transmutes that overlap with stdlib methods. For example, transmuting `[u8; 4]` to `u32`.

Skip to main content

## check_unnecessary_transmute

# Function check_unnecessary_transmute

Source

    fn check_unnecessary_transmute<'tcx>(
        cx: &LateContext<'tcx>,
        expr: &'tcx Expr<'tcx>,
        callee: &'tcx Expr<'tcx>,
        arg: &'tcx Expr<'tcx>,
        const_context: Option<ConstContext>,
        src: Ty<'tcx>,
        dst: Ty<'tcx>,
    )

Expand description

Check for transmutes that overlap with stdlib methods. For example, transmuting `[u8; 4]` to `u32`.

We chose not to lint u8 -> bool transmutes, see #140431.