rust/clippy_config
Fridtjof Stoldt 67e6bf33fe
Suggest using Vec::extend() in same_item_push (#13987)
Using `Vec::extend(std::iter::repeat_n(item, N))` allows to use the more
natural number of elements to add `N`, as is probably done in the
original loop, instead of computing the difference between the existing
number of elements and the wanted one.

Before MSRV 1.82, the older suggestion to use `Vec::resize()` is still
issued.

Inspired by #6156 (which predates `repeat_n()`).

changelog: [`same_item_push`]: recommend using `Vec::extend()` to extend
a vector
2025-01-22 14:41:13 +00:00
..
src Suggest using Vec::extend() in same_item_push 2025-01-15 22:50:25 +01:00
Cargo.toml Select edition 2024 2025-01-13 16:55:42 +01:00