#Why is Clippy's `wrong_transmute` ok for `u64`?

1 messages · Page 1 of 1 (latest)

compact meteor
#

Clippy's wrong_transmute will trigger when transmuting an f64 to a pointer but not if transmuting a u64. Why is that?

Is it because that one could feasibly construct a valid pointer value inside a u64 but an f64 could never possibly be a valid pointer?

timber vortex
#

well, you can't transmute a integer to a valid pointer

#

but

#

you can make invalid pointers with that

#

though you'd usually use usize

#

wrong_transmute doesn't even say anything about what it complains about

#

hmmm

#

i'll read the source

#

okay it's literally just "float or character transmuted to a reference or pointer"?

#

yeah

#

that's a weird lint