mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-09-21 07:01:54 +00:00
Auto merge of #11701 - Alexendoo:vec-init-then-push-docs, r=Jarcho
Use multiple pushes in `vec_init_then_push` example Makes the perf argument clearer, since a single push doesn't have unnecessary allocations compared to `vec![x]` changelog: none
This commit is contained in:
commit
cdc4d56ae7
1 changed files with 3 additions and 1 deletions
|
@ -33,10 +33,12 @@ declare_clippy_lint! {
|
|||
/// ```no_run
|
||||
/// let mut v = Vec::new();
|
||||
/// v.push(0);
|
||||
/// v.push(1);
|
||||
/// v.push(2);
|
||||
/// ```
|
||||
/// Use instead:
|
||||
/// ```no_run
|
||||
/// let v = vec![0];
|
||||
/// let v = vec![0, 1, 2];
|
||||
/// ```
|
||||
#[clippy::version = "1.51.0"]
|
||||
pub VEC_INIT_THEN_PUSH,
|
||||
|
|
Loading…
Reference in a new issue