Commit graph

13 commits

Author SHA1 Message Date
Guillaume Gomez
f666fd6417 Update UI tests 2025-02-15 13:38:16 +01:00
Alex Macleod
66362efb09 Don't suggest Box::default() in functions with differing generics 2024-04-17 14:40:00 +00:00
Alex Macleod
0f63fa8c33 Move box_default to style, do not suggest turbofishes
`Box::default()` had its `#[rustc_box]` attribute removed in 1.69 so is
no longer a perf related lint

The lint is moved to style but no longer produces suggestions containing
turbofishes, as they're often longer/more annoying to type
2024-03-31 16:46:44 +00:00
Ethiraric
97dc4b22c6 [box_default]: Preserve required path segments
When encountering code such as:
```
Box::new(outer::Inner::default())
```
clippy would suggest replacing with `Box::<Inner>::default()`, dropping
the `outer::` segment. This behavior is incorrect and that commit fixes
it.

What it does is it checks the contents of the `Box::new` and, if it is
of the form `A::B::default`, does a text replacement, inserting `A::B`
in the `Box`'s quickfix generic list.
If the source does not match that pattern (including `Vec::from(..)`
or other `T::new()` calls), we then fallback to the original code.

Fixes #11927
2024-02-26 17:39:00 +01:00
Samuel Tardieu
23d533264f Fix box_default behaviour with empty vec![] coming from macro arg 2023-11-26 18:40:50 +01:00
Ralf Jung
1fac304bf5 adjust how closure/generator types and rvalues are printed 2023-09-21 22:20:58 +02:00
Philipp Krones
cc61aeea54 Merge commit '080b587854' into clippyup 2023-08-24 21:32:12 +02:00
Philipp Krones
b76b0aeb63 Merge commit '435a8ad86c' into clippyup 2023-05-20 15:39:26 +02:00
Philipp Krones
7e9abb311d Merge commit '371120bdbf' into clippyup 2023-05-05 17:45:49 +02:00
Philipp Krones
a1b75c5108 Merge commit 'a3ed905928' into clippyup 2023-04-23 13:28:56 +02:00
Jason Newcomb
0413fb35ba Merge commit '149392b0ba' into clippyup 2023-02-25 19:28:50 -05:00
Philipp Krones
d21616737b Merge commit '7f27e2e74e' into clippyup 2023-01-12 19:48:13 +01:00
flip1995
cd0bb7de01 Merge commit '4f142aa105' into clippyup 2022-10-23 15:18:45 +02:00