mirror of
https://github.com/rust-lang/rust.git
synced 2026-05-28 20:16:58 +03:00
97dc4b22c6
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