]> git.lizzy.rs Git - rust.git/blob - src/docs/empty_drop.txt
[Arithmetic] Consider literals
[rust.git] / src / docs / empty_drop.txt
1 ### What it does
2 Checks for empty `Drop` implementations.
3
4 ### Why is this bad?
5 Empty `Drop` implementations have no effect when dropping an instance of the type. They are
6 most likely useless. However, an empty `Drop` implementation prevents a type from being
7 destructured, which might be the intention behind adding the implementation as a marker.
8
9 ### Example
10 ```
11 struct S;
12
13 impl Drop for S {
14     fn drop(&mut self) {}
15 }
16 ```
17 Use instead:
18 ```
19 struct S;
20 ```