Matthias Krüger
fbc121fdfd
Rollup merge of #104363 - WaffleLapkin:bonk_box_new, r=Nilstrieb
...
Make `unused_allocation` lint against `Box::new` too
Previously it only linted against `box` syntax, which likely won't ever be stabilized, which is pretty useless. Even now I'm not sure if it's a meaningful lint, but it's at least something 🤷
This means that code like the following will be linted against:
```rust
Box::new([1, 2, 3]).len();
f(&Box::new(1)); // where f : &i32 -> ()
```
The lint works by checking if a `Box::new` (or `box`) expression has an a borrow adjustment, meaning that the code that first stores the box in a variable won't be linted against:
```rust
let boxed = Box::new([1, 2, 3]); // no lint
boxed.len();
```
2023-03-11 15:43:11 +01:00
..
2023-02-28 15:59:47 +01:00
2023-02-23 10:27:06 -07:00
2023-03-10 21:15:42 +01:00
2023-02-22 21:52:26 +00:00
2023-02-22 21:52:26 +00:00
2023-03-06 09:28:49 +00:00
2023-03-05 09:34:00 +13:00
2023-03-02 02:42:19 +00:00
2023-03-06 21:25:43 +08:00
2023-03-09 17:45:13 +00:00
2023-03-09 17:45:13 +00:00
2023-02-28 01:21:15 +00:00
2023-03-08 21:24:52 +01:00
2023-02-28 15:59:47 +01:00
2023-03-09 20:49:11 +00:00
2023-03-09 17:45:13 +00:00
2023-03-08 00:00:18 +00:00
2023-02-28 14:58:14 -08:00
2023-02-23 19:05:13 +09:00
2023-02-28 16:44:59 +00:00
2023-03-10 20:32:24 +13:00
2023-03-10 20:32:24 +13:00
2023-03-01 13:26:59 +01:00
2023-02-23 10:27:06 -07:00
2023-02-23 10:27:06 -07:00
2023-03-06 23:33:07 +00:00
2023-03-07 19:57:44 +01:00
2023-02-28 15:59:47 +01:00
2023-03-11 15:43:11 +01:00
2023-03-03 17:47:48 +00:00
2023-02-23 10:27:06 -07:00
2023-03-01 13:26:59 +01:00
2023-03-10 20:32:24 +13:00
2023-03-11 15:43:11 +01:00
2023-03-03 16:33:11 +01:00
2023-03-01 13:26:59 +01:00
2023-03-03 17:47:48 +00:00
2023-02-28 07:57:17 +00:00
2023-03-01 16:57:11 +00:00
2023-03-05 20:55:29 +00:00
2023-03-07 03:50:22 +00:00
2023-03-02 05:27:32 +00:00
2023-03-09 21:29:32 +13:00
2023-02-28 15:59:47 +01:00
2023-03-08 00:00:18 +00:00
2023-02-23 00:19:12 +00:00
2023-03-01 01:20:22 +01:00
2023-02-26 00:01:44 +02:00
2023-02-25 15:19:13 +00:00
2023-02-24 12:02:40 +05:30
2023-03-10 13:50:51 +01:00
2023-02-28 15:59:47 +01:00
2023-02-22 20:48:27 +00:00
2023-03-11 15:43:11 +01:00
2023-03-08 00:00:18 +00:00
2023-03-09 20:49:11 +00:00
2023-03-06 16:41:56 +01:00
2023-03-09 22:44:58 +08:00
2023-02-23 10:27:06 -07:00
2023-03-03 17:47:48 +00:00
2023-03-09 12:11:52 +01:00
2023-03-02 13:41:17 +01:00
2023-03-02 18:21:44 +00:00
2023-02-28 15:59:47 +01:00
2023-02-26 10:29:25 +00:00
2023-03-10 19:59:19 +01:00
2023-03-09 20:49:11 +00:00
2023-02-28 07:57:17 +00:00
2023-02-23 10:27:06 -07:00
2023-03-03 05:02:34 +00:00
2023-03-09 17:24:07 +00:00
2023-02-23 10:27:06 -07:00
2023-02-23 10:27:06 -07:00
2023-03-09 08:21:17 +00:00
2023-03-09 17:45:13 +00:00
2023-03-05 12:49:01 +03:00
2023-03-01 13:26:59 +01:00
2023-02-23 10:27:06 -07:00
2023-02-23 10:27:06 -07:00
2023-03-08 00:00:18 +00:00
2023-03-08 00:00:18 +00:00
2023-03-08 00:00:18 +00:00
2023-03-08 00:00:18 +00:00
2023-02-23 10:27:06 -07:00
2023-02-23 10:27:06 -07:00
2023-02-28 15:59:47 +01:00