diff options
Diffstat (limited to 'src/docs/drop_ref.txt')
| -rw-r--r-- | src/docs/drop_ref.txt | 17 |
1 files changed, 0 insertions, 17 deletions
diff --git a/src/docs/drop_ref.txt b/src/docs/drop_ref.txt deleted file mode 100644 index c4f7adf0cfa..00000000000 --- a/src/docs/drop_ref.txt +++ /dev/null @@ -1,17 +0,0 @@ -### What it does -Checks for calls to `std::mem::drop` with a reference -instead of an owned value. - -### Why is this bad? -Calling `drop` on a reference will only drop the -reference itself, which is a no-op. It will not call the `drop` method (from -the `Drop` trait implementation) on the underlying referenced value, which -is likely what was intended. - -### Example -``` -let mut lock_guard = mutex.lock(); -std::mem::drop(&lock_guard) // Should have been drop(lock_guard), mutex -// still locked -operation_that_requires_mutex_to_be_unlocked(); -``` \ No newline at end of file |
