Transmuting an & to &mut is Undefined Behavior. While certain usages may appear safe, note that the Rust optimizer is free to assume that a shared reference won't change through its lifetime and thus such transmutation will run afoul of those assumptions. So:
Transmuting an & to &mut is always Undefined Behavior.
clippy::cast_ref_to_mut
に準拠するようにします。Safe Rustの世界で
&
を&mut
に変換しようとする行為はまず禁忌であり、それゆえにこのlintはdeny
になっているはずです。Transmutes - The Rustonomicon