bors
077fc26f0a
Auto merge of #109732 - Urgau:uplift_drop_forget_ref_lints, r=davidtwco
...
Uplift `clippy::{drop,forget}_{ref,copy}` lints
This PR aims at uplifting the `clippy::drop_ref`, `clippy::drop_copy`, `clippy::forget_ref` and `clippy::forget_copy` lints.
Those lints are/were declared in the correctness category of clippy because they lint on useless and most probably is not what the developer wanted.
## `drop_ref` and `forget_ref`
The `drop_ref` and `forget_ref` lint checks for calls to `std::mem::drop` or `std::mem::forget` with a reference instead of an owned value.
### Example
```rust
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();
```
### Explanation
Calling `drop` or `forget` on a reference will only drop the reference itself, which is a no-op. It will not call the `drop` or `forget` method on the underlying referenced value, which is likely what was intended.
## `drop_copy` and `forget_copy`
The `drop_copy` and `forget_copy` lint checks for calls to `std::mem::forget` or `std::mem::drop` with a value that derives the Copy trait.
### Example
```rust
let x: i32 = 42; // i32 implements Copy
std::mem::forget(x) // A copy of x is passed to the function, leaving the
// original unaffected
```
### Explanation
Calling `std::mem::forget` [does nothing for types that implement Copy](https://doc.rust-lang.org/std/mem/fn.drop.html ) since the value will be copied and moved into the function on invocation.
-----
Followed the instructions for uplift a clippy describe here: https://github.com/rust-lang/rust/pull/99696#pullrequestreview-1134072751
cc `@m-ou-se` (as T-libs-api leader because the uplifting was discussed in a recent meeting)
2023-05-12 12:04:32 +00:00
..
2023-04-30 00:06:26 +08:00
2023-04-25 00:08:35 +02:00
2023-04-25 00:08:35 +02:00
2023-05-08 03:36:30 +00:00
2023-05-05 22:40:04 +12:00
2023-03-12 14:57:38 +01:00
2023-04-23 18:09:30 +00:00
2023-05-12 12:04:32 +00:00
2023-01-11 21:30:32 +00:00
2023-05-03 19:41:15 +00:00
2023-04-25 19:53:09 +00:00
2023-05-10 19:36:02 +02:00
2023-04-27 18:33:39 +00:00
2023-03-06 21:25:43 +08:00
2023-04-03 11:08:14 +08:00
2023-04-13 22:08:07 -05:00
2023-04-28 20:28:56 -05:00
2023-04-27 01:34:03 +00:00
2023-01-30 20:12:19 +00:00
2023-01-30 20:12:19 +00:00
2023-05-10 19:36:02 +02:00
2023-04-12 22:50:10 +00:00
2023-01-15 19:46:20 +00:00
2023-01-12 22:25:30 +00:00
2023-01-30 21:51:33 +00:00
2023-01-15 22:17:54 +13:00
2023-04-30 00:06:26 +08:00
2023-04-20 18:01:07 +00:00
2023-05-06 18:40:47 +02:00
2023-02-21 05:21:07 +00:00
2023-05-12 12:04:32 +00:00
2023-04-16 23:09:57 +00:00
2023-04-15 16:11:42 -07:00
2023-05-08 03:36:30 +00:00
2023-04-26 22:34:39 -04:00
2023-02-14 12:18:33 +01:00
2023-04-03 09:24:11 +02:00
2023-01-30 20:12:19 +00:00
2023-04-15 16:11:42 -07:00
2023-01-30 20:12:21 +00:00
2023-04-28 14:42:03 +02:00
2023-05-09 20:49:32 +02:00
2023-05-05 20:36:21 +02:00
2023-05-12 12:04:32 +00:00
2023-01-11 09:32:13 +00:00
2023-04-15 16:11:42 -07:00
2023-05-08 17:58:01 -03:00
2023-01-18 04:07:39 +00:00
2023-01-16 11:09:53 +01:00
2023-05-05 01:22:17 -05:00
2023-02-22 08:40:47 -07:00
2023-01-30 20:12:19 +00:00
2023-04-12 22:50:10 +00:00
2023-04-27 01:34:03 +00:00
2023-05-08 17:58:01 -03:00
2023-04-27 01:34:03 +00:00
2023-02-09 14:52:54 +00:00
2023-03-28 09:18:55 -04:00
2023-05-05 22:40:05 +12:00
2023-05-12 12:04:32 +00:00
2023-05-04 18:06:07 +00:00
2023-03-07 00:39:34 -05:00
2023-05-12 00:58:06 +00:00
2023-03-13 17:31:55 +04:00
2023-05-09 20:49:32 +02:00
2023-05-05 21:42:54 +01:00
2023-05-09 20:49:32 +02:00
2023-02-28 14:58:14 -08:00
2023-05-10 19:36:02 +02:00
2023-02-23 19:05:13 +09:00
2023-04-21 08:40:00 +08:00
2023-01-30 20:12:19 +00:00
2023-05-05 13:02:43 -07:00
2023-05-10 19:36:02 +02:00
2023-05-11 12:14:57 -07:00
2023-05-08 17:58:01 -03:00
2023-03-01 13:26:59 +01:00
2023-01-30 20:12:19 +00:00
2023-01-30 20:12:21 +00:00
2023-01-30 20:12:21 +00:00
2023-05-10 19:36:02 +02:00
2023-05-01 16:15:17 +08:00
2023-05-01 16:37:00 +08:00
2023-04-03 15:59:21 +00:00
2023-01-11 09:32:13 +00:00
2023-04-10 16:36:30 +00:00
2023-05-10 19:36:02 +02:00
2023-02-09 10:26:49 +00:00
2023-05-05 12:46:26 +09:00
2023-04-22 00:47:07 -04:00
2023-04-12 22:50:10 +00:00
2023-01-30 20:12:19 +00:00
2023-02-13 18:41:18 +00:00
2023-05-09 20:49:31 +02:00
2023-04-11 17:45:42 +00:00
2023-04-15 16:11:42 -07:00
2023-02-09 12:29:43 +09:00
2023-05-03 20:09:10 +03:00
2023-04-12 22:50:10 +00:00
2023-04-13 22:08:07 -05:00
2023-02-28 15:59:47 +01:00
2023-05-01 13:37:15 -07:00
2023-04-25 15:25:19 +00:00
2023-05-09 20:49:31 +02:00
2023-03-03 17:47:48 +00:00
2023-01-30 20:12:19 +00:00
2023-05-03 20:09:10 +03:00
2023-03-12 13:19:46 +00:00
2023-03-07 21:26:19 +01:00
2023-05-05 16:05:04 -07:00
2023-03-01 13:26:59 +01:00
2023-04-10 06:52:41 +00:00
2023-05-05 21:42:54 +01:00
2023-04-15 07:46:46 +00:00
2023-03-19 11:23:19 +08:00
2023-05-10 19:36:02 +02:00
2023-05-10 19:36:02 +02:00
2023-03-01 13:26:59 +01:00
2023-05-12 12:04:32 +00:00
2023-04-12 22:50:10 +00:00
2023-03-22 11:37:57 +01:00
2023-04-30 14:08:26 +00:00
2023-04-18 07:14:01 -05:00
2023-05-08 03:36:30 +00:00
2023-04-20 18:01:07 +00:00
2023-05-08 03:36:30 +00:00
2023-04-25 00:08:35 +02:00
2023-01-13 20:50:34 +00:00
2023-04-12 22:50:10 +00:00
2023-03-22 21:12:40 -07:00
2023-02-16 11:42:35 -03:00
2023-05-08 03:36:30 +00:00
2023-04-12 22:50:10 +00:00
2023-05-05 18:54:06 +01:00
2023-05-10 19:36:02 +02:00
2023-05-12 12:04:32 +00:00
2023-04-03 09:24:11 +02:00
2023-03-22 21:12:40 -07:00
2023-05-03 20:09:10 +03:00
2023-04-20 14:27:29 +09:00
2023-04-20 09:41:38 +00:00
2023-05-05 21:44:48 +02:00
2023-04-12 22:50:10 +00:00
2023-05-10 19:36:02 +02:00
2023-01-12 22:25:30 +00:00
2023-04-28 20:28:56 -05:00
2023-04-29 13:01:46 +01:00
2023-05-05 07:18:06 +10:00
2023-05-09 12:33:45 +05:30
2023-05-10 19:36:02 +02:00
2023-01-11 14:09:14 -08:00
2023-04-21 16:14:43 +00:00
2023-05-10 19:36:02 +02:00
2023-04-21 22:12:45 +00:00
2023-04-24 07:53:23 +02:00
2023-04-26 01:55:50 -05:00
2023-02-01 21:50:34 +01:00
2023-01-11 21:30:10 +00:00
2023-02-02 05:49:07 +00:00
2023-05-08 03:42:21 +00:00
2023-05-09 20:49:31 +02:00
2023-05-03 20:09:10 +03:00
2023-02-22 13:08:13 +00:00
2023-05-10 19:36:02 +02:00
2023-04-12 22:50:10 +00:00
2023-05-01 15:05:39 +01:00
2023-05-11 13:21:10 +01:00
2023-01-30 20:12:19 +00:00
2023-03-27 11:08:11 -04:00
2023-03-29 11:27:26 -03:00
2023-04-03 15:59:21 +00:00
2023-05-10 19:36:02 +02:00
2023-03-18 13:46:17 +00:00
2023-01-17 03:06:38 +00:00
2023-01-30 20:12:19 +00:00
2023-05-10 19:36:02 +02:00
2023-01-13 16:54:23 +09:00
2023-02-25 15:19:13 +00:00
2023-02-01 05:54:39 +01:00
2023-04-21 22:32:38 +00:00
2023-04-18 11:01:07 -07:00
2023-05-05 16:19:18 +01:00
2023-05-02 10:32:08 +00:00
2023-04-03 09:24:11 +02:00
2023-05-10 19:36:02 +02:00
2023-04-12 22:50:10 +00:00
2023-03-30 22:56:52 +02:00
2023-05-03 22:41:29 +00:00
2023-05-04 19:18:20 +02:00
2023-04-12 22:50:10 +00:00
2023-05-05 14:58:52 -07:00
2023-02-14 03:46:43 +00:00
2023-05-09 12:33:45 +05:30
2023-05-09 12:33:46 +05:30
2023-04-29 13:01:46 +01:00
2023-04-19 19:13:45 +00:00
2023-05-10 19:36:02 +02:00
2023-04-04 15:34:40 +00:00
2023-04-13 22:10:26 -05:00
2023-01-19 21:09:25 +01:00
2023-05-08 03:36:30 +00:00
2023-04-12 22:50:10 +00:00
2023-05-08 14:58:09 +08:00
2023-05-09 12:33:46 +05:30
2023-04-05 18:35:34 +00:00
2023-03-29 18:04:44 -04:00
2023-04-30 00:06:26 +08:00
2023-05-08 17:58:01 -03:00
2023-04-05 15:59:29 +00:00
2023-04-26 22:34:30 -04:00
2023-04-26 21:02:56 +02:00
2023-04-07 08:33:56 +01:00
2023-02-01 21:50:34 +01:00
2023-04-12 22:50:10 +00:00
2023-05-12 12:04:32 +00:00
2023-04-18 17:33:46 -07:00
2023-04-13 21:57:08 +00:00
2023-02-07 19:17:24 +00:00
2023-05-10 19:36:02 +02:00
2023-01-15 19:46:20 +00:00
2023-04-02 19:42:30 -04:00
2023-05-09 12:33:46 +05:30
2023-04-20 18:01:07 +00:00
2023-05-07 01:41:20 +03:00
2023-02-22 08:40:47 -07:00
2023-05-08 03:36:30 +00:00
2023-05-01 16:15:17 +08:00
2023-02-23 10:27:06 -07:00
2023-04-12 22:50:10 +00:00
2023-02-01 01:14:34 +00:00
2023-05-03 20:09:10 +03:00
2023-04-02 19:42:30 -04:00
2023-04-12 22:50:10 +00:00
2023-04-02 19:42:30 -04:00
2023-02-21 05:21:07 +00:00
2023-05-08 03:36:30 +00:00
2023-04-29 13:01:46 +01:00
2023-03-22 21:12:40 -07:00
2023-04-02 19:42:30 -04:00
2023-04-02 19:42:30 -04:00
2023-04-22 13:57:34 -04:00
2023-04-12 22:50:10 +00:00
2023-03-01 13:26:59 +01:00
2023-01-19 19:35:49 +00:00
2023-01-15 19:46:20 +00:00
2023-01-15 19:46:20 +00:00
2023-02-18 02:42:43 +00:00
2023-03-12 13:19:46 +00:00
2023-03-12 13:19:46 +00:00
2023-02-23 10:27:06 -07:00
2023-02-23 10:27:06 -07:00
2023-05-10 19:36:02 +02:00
2023-01-30 20:12:19 +00:00
2023-01-30 20:12:19 +00:00
2023-01-16 20:24:01 +13:00
2023-03-08 00:00:18 +00:00
2023-03-08 00:00:18 +00:00
2023-02-22 08:40:47 -07:00
2023-04-13 22:10:26 -05:00
2023-01-27 05:28:52 -08:00
2023-01-27 05:28:52 -08:00
2023-01-27 05:28:52 -08:00
2023-01-27 05:28:52 -08:00
2023-01-27 05:28:52 -08:00
2023-01-27 05:28:52 -08:00
2023-05-10 19:36:02 +02:00
2023-05-10 19:36:02 +02:00
2023-05-10 19:36:02 +02:00
2023-04-08 21:32:55 +00:00
2023-04-08 21:32:55 +00:00
2023-04-13 22:08:07 -05:00
2023-04-13 22:08:07 -05:00
2023-04-13 22:10:26 -05:00
2023-04-13 22:08:07 -05:00
2023-04-13 22:08:07 -05:00
2023-04-13 22:08:07 -05:00
2023-04-13 22:08:07 -05:00
2023-02-13 18:41:18 +00:00
2023-04-17 22:40:31 -05:00
2023-04-17 22:40:31 -05:00
2023-04-17 22:40:31 -05:00
2023-04-13 22:08:07 -05:00
2023-01-30 20:12:19 +00:00
2023-01-30 20:12:19 +00:00
2023-04-12 22:50:10 +00:00
2023-01-30 20:12:21 +00:00
2023-04-25 00:08:33 +02:00
2023-03-08 00:00:18 +00:00
2023-03-08 00:00:18 +00:00
2023-05-04 15:39:21 +02:00
2023-05-03 20:09:10 +03:00
2023-01-30 20:12:19 +00:00
2023-01-30 21:51:33 +00:00
2023-02-23 10:27:06 -07:00
2023-02-23 10:27:06 -07:00
2023-03-26 17:30:29 +00:00
2023-02-04 20:13:16 -08:00
2023-02-04 20:13:16 -08:00
2023-02-04 20:13:16 -08:00
2023-01-30 20:12:19 +00:00
2023-01-15 19:46:20 +00:00
2023-02-28 15:59:47 +01:00