mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-12-13 14:52:46 +00:00
6b01c39e64
Add new lint for undropped ManuallyDrop values Adds a new lint for the following code: ```rust struct S; impl Drop for S { fn drop(&mut self) { println!("drip drop"); } } fn main() { // This will not drop the `S`!!! drop(std::mem::ManuallyDrop::new(S)); unsafe { // This will. std::mem::ManuallyDrop::drop(&mut std::mem::ManuallyDrop::new(S)); } } ``` The inner value of a `ManuallyDrop` will not be dropped unless the proper, unsafe drop function is called on it. This lint makes sure that a user does not accidently use the wrong function and forget to drop a `ManuallyDrop` value. Fixes #5581. --- *Please keep the line below* changelog: none |
||
---|---|---|
.. | ||
src | ||
Cargo.toml | ||
README.md |