]>
Commit | Line | Data |
---|---|---|
f2b60f7d FG |
1 | ### What it does |
2 | Checks for calls to `std::mem::drop` with a reference | |
3 | instead of an owned value. | |
4 | ||
5 | ### Why is this bad? | |
6 | Calling `drop` on a reference will only drop the | |
7 | reference itself, which is a no-op. It will not call the `drop` method (from | |
8 | the `Drop` trait implementation) on the underlying referenced value, which | |
9 | is likely what was intended. | |
10 | ||
11 | ### Example | |
12 | ``` | |
13 | let mut lock_guard = mutex.lock(); | |
14 | std::mem::drop(&lock_guard) // Should have been drop(lock_guard), mutex | |
15 | // still locked | |
16 | operation_that_requires_mutex_to_be_unlocked(); | |
17 | ``` |