about summary refs log tree commit diff
path: root/compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp
diff options
context:
space:
mode:
authorFridtjof Stoldt <xFrednet@gmail.com>2025-01-22 14:41:13 +0000
committerGitHub <noreply@github.com>2025-01-22 14:41:13 +0000
commit67e6bf33fee137e8419863342bac0eecaae0f221 (patch)
tree8bf5d480c745ceacc372e58f815d4ee56632b476 /compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp
parent88d83b6e55ff3bf0b50f01d674c54b83acd21dc6 (diff)
parentded9354dcf76aaa2cd2164a8b556f61c2f188d79 (diff)
downloadrust-67e6bf33fee137e8419863342bac0eecaae0f221.tar.gz
rust-67e6bf33fee137e8419863342bac0eecaae0f221.zip
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
Diffstat (limited to 'compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp')
0 files changed, 0 insertions, 0 deletions