diff options
Diffstat (limited to 'src/docs/empty_drop.txt')
| -rw-r--r-- | src/docs/empty_drop.txt | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/docs/empty_drop.txt b/src/docs/empty_drop.txt new file mode 100644 index 00000000000..d0c0c24a9c8 --- /dev/null +++ b/src/docs/empty_drop.txt @@ -0,0 +1,20 @@ +### What it does +Checks for empty `Drop` implementations. + +### Why is this bad? +Empty `Drop` implementations have no effect when dropping an instance of the type. They are +most likely useless. However, an empty `Drop` implementation prevents a type from being +destructured, which might be the intention behind adding the implementation as a marker. + +### Example +``` +struct S; + +impl Drop for S { + fn drop(&mut self) {} +} +``` +Use instead: +``` +struct S; +``` \ No newline at end of file |
