False positive for useless_transmute #6356
Labels
C-bug
Category: Clippy is not doing the correct thing
E-hard
Call for participation: This a hard problem and requires more experience or effort to work on
I-suggestion-causes-error
Issue: The suggestions provided by this Lint cause an ICE/error when applied
Source: (SO question, playground link)
Result:
The transmute is not useless because without it the code does not compile. The comments make it a little clearer what's going on: the transmute is being used to change lifetimes, but since this is not represented in the syntax it looks like it's casting a type to itself. My suggested fix would be to skip the lint if the type being cast to itself contains embedded lifetimes (either a shared or unique reference, or a lifetime parameter in the type).
Meta
cargo clippy -V
: clippy 0.0.212 (1773f60 2020-11-08)rustc -Vv
:The text was updated successfully, but these errors were encountered: