about summary refs log tree commit diff
path: root/compiler/rustc_llvm/llvm-wrapper
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2023-06-08 04:33:26 +0000
committerbors <bors@rust-lang.org>2023-06-08 04:33:26 +0000
commit177c6fea1f40d40e213564e0897aab9780e49122 (patch)
tree1213ef0fd9b3d5b2d593aa63985c159a71bfc7b1 /compiler/rustc_llvm/llvm-wrapper
parent9ca1344d9ad5724fcac3e29b9d6fa084f3e59f52 (diff)
parent7af77f74da28b51207cb35dd7d627109571eb678 (diff)
downloadrust-177c6fea1f40d40e213564e0897aab9780e49122.tar.gz
rust-177c6fea1f40d40e213564e0897aab9780e49122.zip
Auto merge of #10901 - y21:smarter-useless-vec, r=Manishearth,Centri3
[`useless_vec`]: lint `vec!` invocations when a slice or an array would do

First off, sorry for that large diff in tests. *A lot* of tests seem to trigger the lint with this new change, so I decided to `#![allow()]` the lint in the affected tests to make reviewing this easier, and also split the commits up so that the first commit is the actual logic of the lint and the second commit contains all the test changes. The stuff that changed in the tests is mostly just line numbers now. So, as large as the diff looks, it's not actually that bad. 😅
I manually went through all of these to find out about edge cases and decided to put them in `tests/ui/vec.rs`.

For more context, I wrote about the idea of this PR here: https://github.com/rust-lang/rust-clippy/issues/2262#issuecomment-1579155257 (that explains the logic)

Basically, it now also considers the case where a `Vec` is put in a local variable and the user only ever does things with it that one could also do with a slice or an array. This should catch a lot more cases, and (at least from looking at the tests) it does.

changelog: [`useless_vec`]: lint `vec!` invocations when a slice or an array would do (also considering local variables now)
Diffstat (limited to 'compiler/rustc_llvm/llvm-wrapper')
0 files changed, 0 insertions, 0 deletions