← Rule catalog

Clippy · Correctness

Transmute without explicit source and target types

clippy::missing_transmute_annotations

Name both types, as in transmute::<From, To>(value), so a change elsewhere cannot silently change what is reinterpreted.

Category
Correctness
Default level
warn
Tier
P2
Producer
Clippy
Diff scope
line

Not a defect when

The transmute is passed straight to a function whose parameter type is fixed by a stable signature, and its input is a typed parameter one line above, so both types stay in plain sight.

What it reads

Clippy, with the compiler behind it. The only pass that compiles.

Tier

Ordinary defect.

The tier bounds how severe a rule may be; its category bounds the tier.

Diff scope

The changed line itself.

What --scope contextual looks at to decide whether a change caused the finding.

Change it

Turn it off, or make it blocking, without touching the code it flags:

rust-doctor --rule clippy::missing_transmute_annotations=off .
rust-doctor --rule clippy::missing_transmute_annotations=error .

Set it once in rust-doctor.toml

Upstream

Clippy's own documentation for this lint

Other Correctness rules