bors
73be4863f0
Auto merge of #12459 - y21:unconditional_recursion_from_into, r=Jarcho
...
lint when calling the blanket `Into` impl from a `From` impl
Closes #11150
```
warning: function cannot return without recursing
--> x.rs:9:9
|
9 | / fn from(value: f32) -> Self {
10 | | value.into()
11 | | }
| |_________^
|
note: recursive call site
--> x.rs:10:13
|
10 | value.into()
| ^^^^^^^^^^^^
```
I'm also thinking that we can probably generalize this lint to #11032 at some point (instead of hardcoding a bunch of impls), like how rustc's `unconditional_recursion` works, at least up to one indirect call, but this still seems useful for now :)
I've also noticed that we use `fn_def_id` in a bunch of lints and then try to get the node args of the call in a separate step, so I made a helper function that does both in one. I intend to refactor a bunch of uses of `fn_def_id` to use this later
I can add more test cases, but this is already using much of the same logic that exists for the other impls that this lint looks for (e.g. making sure that there are no conditional returns).
changelog: [`unconditional_recursion`]: emit a warning inside of `From::from` when unconditionally calling the blanket `.into()` impl
2024-03-13 16:32:25 +00:00
..
2024-03-09 12:43:18 +01:00
2024-02-08 20:24:42 +01:00
2024-03-12 10:16:27 -05:00
2024-03-12 10:40:40 +08:00
2024-02-28 08:55:35 +11:00
2024-02-28 03:48:49 +09:00
2024-03-11 01:08:37 +08:00
2024-03-12 10:00:15 +00:00
2023-12-01 18:21:58 +01:00
2024-03-05 14:34:56 +00:00
2024-03-03 23:55:01 +01:00
2024-03-07 17:14:36 +01:00
2024-02-27 15:50:17 +01:00
2024-02-28 08:55:35 +11:00
2024-02-07 09:38:24 +03:00
2023-12-01 18:21:58 +01:00
2023-12-01 18:21:58 +01:00
2024-03-01 13:59:06 -05:00
2024-01-25 19:17:36 +01:00
2023-12-16 14:12:50 +01:00
2024-02-27 15:50:17 +01:00
2024-02-10 12:24:46 +03:00
2023-12-01 18:21:58 +01:00
2024-03-01 16:37:23 +01:00
2024-01-16 17:12:10 +00:00
2023-12-25 21:13:41 +00:00
2024-02-27 15:50:17 +01:00
2023-12-01 18:21:58 +01:00
2023-12-01 18:21:58 +01:00
2024-03-03 08:32:30 +01:00
2023-12-16 14:12:50 +01:00
2024-02-27 15:50:17 +01:00
2023-12-01 18:21:58 +01:00
2023-12-01 18:21:58 +01:00
2023-12-01 18:21:58 +01:00
2024-02-27 15:50:17 +01:00
2023-12-01 18:21:58 +01:00
2024-02-13 21:03:34 +00:00
2023-12-01 18:21:58 +01:00
2023-12-11 09:36:40 +11:00
2023-12-01 18:21:58 +01:00
2024-02-10 12:24:46 +03:00
2024-03-11 18:36:21 +00:00
2023-12-28 19:33:07 +01:00
2024-01-25 19:17:36 +01:00
2024-02-10 12:24:46 +03:00
2024-01-18 16:07:10 +00:00
2024-02-07 22:57:55 +00:00
2024-02-27 15:50:17 +01:00
2024-02-07 09:38:24 +03:00
2024-03-02 00:37:35 +08:00
2024-02-28 08:55:35 +11:00
2023-12-01 18:21:58 +01:00
2023-12-01 18:21:58 +01:00
2024-03-05 08:11:45 +11:00
2023-12-01 18:21:58 +01:00
2023-12-01 18:21:58 +01:00
2024-02-27 15:50:17 +01:00
2023-12-01 18:21:58 +01:00
2023-12-01 18:21:58 +01:00
2024-02-07 09:38:24 +03:00
2023-12-01 18:21:58 +01:00
2024-01-11 17:27:03 +01:00
2023-12-01 18:21:58 +01:00
2024-02-27 15:20:49 +01:00
2023-12-01 18:21:58 +01:00
2024-01-17 03:14:16 +01:00
2023-12-01 18:21:58 +01:00
2024-02-13 21:03:34 +00:00
2024-02-08 20:24:42 +01:00
2023-12-01 18:21:58 +01:00
2023-12-01 18:21:58 +01:00
2023-12-01 18:21:58 +01:00
2023-12-12 06:40:29 -08:00
2024-02-07 09:38:24 +03:00
2023-12-01 18:21:58 +01:00
2023-12-01 18:21:58 +01:00
2024-03-01 13:59:06 -05:00
2023-12-01 18:21:58 +01:00
2024-02-27 15:50:17 +01:00
2024-02-27 15:50:17 +01:00
2023-12-28 19:33:07 +01:00
2023-12-01 18:21:58 +01:00
2023-12-01 18:21:58 +01:00
2023-12-01 18:21:58 +01:00
2024-01-26 09:42:12 +01:00
2023-12-01 18:21:58 +01:00
2023-12-01 18:21:58 +01:00
2023-12-01 18:21:58 +01:00
2024-02-28 08:55:35 +11:00
2023-12-01 18:21:58 +01:00
2024-01-11 17:27:03 +01:00
2024-02-10 12:24:46 +03:00
2023-12-01 18:21:58 +01:00
2024-02-28 08:55:35 +11:00
2024-01-06 01:25:20 +03:00
2024-01-19 20:10:39 -08:00
2024-01-19 20:10:39 -08:00
2024-02-27 15:50:17 +01:00
2024-02-27 15:50:17 +01:00
2023-12-01 18:21:58 +01:00
2024-02-27 15:50:17 +01:00
2024-02-27 15:50:17 +01:00
2023-12-28 19:33:07 +01:00
2023-12-01 18:21:58 +01:00
2024-01-25 19:17:36 +01:00
2023-12-01 18:21:58 +01:00
2023-12-01 18:21:58 +01:00
2024-03-05 12:14:49 +11:00
2024-01-11 17:27:03 +01:00
2023-12-01 18:21:58 +01:00
2023-12-01 18:21:58 +01:00
2024-02-27 15:50:17 +01:00
2023-12-01 18:21:58 +01:00
2023-12-01 18:21:58 +01:00
2024-02-27 15:50:17 +01:00
2024-02-08 20:24:42 +01:00
2024-02-10 12:24:46 +03:00
2023-12-01 18:21:58 +01:00
2023-12-01 18:21:58 +01:00
2023-12-01 18:21:58 +01:00
2023-12-01 18:21:58 +01:00
2023-12-01 18:21:58 +01:00
2023-12-01 18:21:58 +01:00
2024-02-07 09:38:24 +03:00
2024-03-09 17:43:04 +01:00
2024-03-03 14:03:02 +01:00
2023-12-01 18:21:58 +01:00
2024-03-10 01:23:28 +01:00
2024-02-10 12:24:46 +03:00
2024-01-11 17:27:03 +01:00
2023-12-01 18:21:58 +01:00
2023-12-01 18:21:58 +01:00
2023-12-01 18:21:58 +01:00
2023-12-01 18:21:58 +01:00
2023-12-28 19:33:07 +01:00
2024-01-19 20:10:39 -08:00
2024-02-28 08:55:35 +11:00
2023-12-16 14:12:50 +01:00
2024-02-10 12:24:46 +03:00
2024-02-27 15:50:17 +01:00
2023-12-28 19:33:07 +01:00
2023-12-01 18:21:58 +01:00
2023-12-20 00:07:34 +00:00
2024-01-19 20:10:39 -08:00
2024-02-10 12:24:46 +03:00
2024-03-09 18:58:40 -06:00
2023-12-01 18:21:58 +01:00
2023-12-16 14:12:50 +01:00
2024-01-19 20:10:39 -08:00
2024-03-10 01:23:28 +01:00
2023-12-01 18:21:58 +01:00
2023-12-01 18:21:58 +01:00
2024-02-27 15:50:17 +01:00
2024-02-27 15:50:17 +01:00
2023-12-01 18:21:58 +01:00
2023-12-01 18:21:58 +01:00
2023-12-01 18:21:58 +01:00
2023-12-01 18:21:58 +01:00
2024-02-28 08:55:35 +11:00
2023-12-24 08:05:28 +11:00
2024-03-08 16:32:47 +08:00
2024-01-11 17:27:03 +01:00
2023-12-12 06:40:29 -08:00
2023-12-10 10:56:22 +08:00
2023-12-01 18:21:58 +01:00
2024-02-10 12:24:46 +03:00
2023-12-01 18:21:58 +01:00
2023-12-01 18:21:58 +01:00
2024-02-27 15:50:17 +01:00
2023-12-01 18:21:58 +01:00
2024-01-08 20:30:10 +00:00
2024-03-09 17:43:04 +01:00
2023-12-01 18:21:58 +01:00
2023-12-01 18:21:58 +01:00
2024-01-11 17:27:03 +01:00
2023-12-01 18:21:58 +01:00
2024-02-27 15:50:17 +01:00
2023-12-01 18:21:58 +01:00
2023-12-16 14:12:50 +01:00
2023-12-19 12:26:20 -08:00
2023-12-01 18:21:58 +01:00
2023-12-01 18:21:58 +01:00
2023-12-16 14:12:50 +01:00
2023-12-01 18:21:58 +01:00
2023-12-01 18:21:58 +01:00
2024-02-27 15:50:17 +01:00
2024-02-28 08:55:35 +11:00
2023-12-25 21:13:41 +00:00
2023-12-01 18:21:58 +01:00
2023-12-01 18:21:58 +01:00
2023-12-01 18:21:58 +01:00
2024-03-05 12:14:49 +11:00
2024-02-27 15:50:17 +01:00
2023-12-01 18:21:58 +01:00
2024-02-27 15:50:17 +01:00
2024-02-10 12:24:46 +03:00
2024-02-27 15:50:17 +01:00
2024-01-11 17:27:03 +01:00
2023-12-12 06:40:29 -08:00
2023-12-01 18:21:58 +01:00
2023-12-01 18:21:58 +01:00
2024-02-27 15:50:17 +01:00
2023-12-01 18:21:58 +01:00
2023-12-28 19:33:07 +01:00
2023-12-01 18:21:58 +01:00
2023-12-01 18:21:58 +01:00
2023-12-01 18:21:58 +01:00
2023-12-01 18:21:58 +01:00
2023-12-01 18:21:58 +01:00
2023-12-01 18:21:58 +01:00
2024-02-10 12:24:46 +03:00
2023-12-01 18:21:58 +01:00
2023-12-01 18:21:58 +01:00
2023-12-01 18:21:58 +01:00
2023-12-01 18:21:58 +01:00
2023-12-01 18:21:58 +01:00
2024-02-27 15:50:17 +01:00
2023-12-01 18:21:58 +01:00
2023-12-01 18:21:58 +01:00
2024-02-28 00:53:25 +01:00
2023-12-01 18:21:58 +01:00
2023-12-01 18:21:58 +01:00
2023-12-01 18:21:58 +01:00
2024-03-09 17:43:04 +01:00
2023-12-28 19:33:07 +01:00
2024-01-15 19:07:11 +01:00
2024-03-09 17:43:04 +01:00
2023-12-19 12:26:20 -08:00
2024-03-07 12:21:16 +00:00
2024-02-11 22:09:52 +00:00
2023-12-01 18:21:58 +01:00
2023-12-01 18:21:58 +01:00
2023-12-01 18:21:58 +01:00
2024-02-15 14:46:08 +11:00
2023-12-01 18:21:58 +01:00
2023-12-01 18:21:58 +01:00
2023-12-01 18:21:58 +01:00
2023-12-01 18:21:58 +01:00
2023-12-16 14:12:50 +01:00
2024-02-08 20:24:42 +01:00
2023-12-01 18:21:58 +01:00
2023-12-01 18:21:58 +01:00
2024-03-09 17:43:04 +01:00
2024-02-27 15:50:17 +01:00
2024-02-07 09:38:24 +03:00
2023-12-01 18:21:58 +01:00
2024-01-25 19:17:36 +01:00
2024-01-11 17:27:03 +01:00
2023-12-01 18:21:58 +01:00
2023-12-01 18:21:58 +01:00
2024-02-27 15:50:17 +01:00
2023-12-01 18:21:58 +01:00
2023-12-01 18:21:58 +01:00
2023-12-01 18:21:58 +01:00
2023-12-01 18:21:58 +01:00
2023-12-01 18:21:58 +01:00
2024-02-27 15:50:17 +01:00
2024-03-09 18:37:18 +01:00
2023-12-01 18:21:58 +01:00
2024-02-27 15:50:17 +01:00
2023-12-19 12:26:20 -08:00
2023-12-12 06:40:29 -08:00
2023-12-01 18:21:58 +01:00
2023-12-01 18:21:58 +01:00
2023-12-01 18:21:58 +01:00
2023-12-01 18:21:58 +01:00
2023-12-01 18:21:58 +01:00
2023-12-01 18:21:58 +01:00
2024-03-03 15:43:09 +01:00
2023-12-01 18:21:58 +01:00
2024-02-27 15:50:17 +01:00
2023-12-01 18:21:58 +01:00
2024-01-25 19:17:36 +01:00
2024-02-27 15:50:17 +01:00
2024-03-13 17:22:54 +01:00
2024-02-27 15:50:17 +01:00
2023-12-01 18:21:58 +01:00
2024-01-18 16:07:10 +00:00
2023-12-01 18:21:58 +01:00
2023-12-01 18:21:58 +01:00
2023-12-06 09:03:48 +01:00
2024-02-10 12:24:46 +03:00
2023-12-16 14:12:50 +01:00
2023-12-01 18:21:58 +01:00
2023-12-01 18:21:58 +01:00
2023-12-12 06:40:29 -08:00
2024-02-10 12:24:46 +03:00
2024-01-17 03:14:16 +01:00
2023-12-01 18:21:58 +01:00
2024-02-10 12:24:46 +03:00
2024-03-09 17:43:04 +01:00
2024-03-09 17:43:04 +01:00
2023-12-01 18:21:58 +01:00
2023-12-01 18:21:58 +01:00
2024-02-27 15:50:17 +01:00
2023-12-01 18:21:58 +01:00
2024-02-10 12:24:46 +03:00
2023-12-01 18:21:58 +01:00
2024-01-18 16:07:10 +00:00
2024-02-07 22:57:55 +00:00
2023-12-01 18:21:58 +01:00
2024-02-27 15:50:17 +01:00
2023-12-01 18:21:58 +01:00
2024-03-12 14:38:57 +08:00
2023-12-01 18:21:58 +01:00
2023-12-01 18:21:58 +01:00
2024-03-09 19:04:35 +00:00
2024-01-18 16:07:10 +00:00