about summary refs log tree commit diff
path: root/compiler/rustc_codegen_llvm/src/llvm_util.rs
diff options
context:
space:
mode:
authorEthiraric <ethiraric@gmail.com>2024-02-26 12:58:41 +0100
committerEthiraric <ethiraric@gmail.com>2024-02-26 17:39:00 +0100
commit97dc4b22c61ab52de80b495ca0e583c4c5c73a9f (patch)
tree4718a8ffe64093662f61a0c7273445b0dbe1404c /compiler/rustc_codegen_llvm/src/llvm_util.rs
parentb09fb8ab3be9144725289ae89e60bb28301fe3c0 (diff)
downloadrust-97dc4b22c61ab52de80b495ca0e583c4c5c73a9f.tar.gz
rust-97dc4b22c61ab52de80b495ca0e583c4c5c73a9f.zip
[`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
Diffstat (limited to 'compiler/rustc_codegen_llvm/src/llvm_util.rs')
0 files changed, 0 insertions, 0 deletions