Skip to content

Commit cdc4d56

Browse files
committed
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
2 parents 325e9fd + e1b287c commit cdc4d56

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

clippy_lints/src/vec_init_then_push.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,12 @@ declare_clippy_lint! {
3333
/// ```no_run
3434
/// let mut v = Vec::new();
3535
/// v.push(0);
36+
/// v.push(1);
37+
/// v.push(2);
3638
/// ```
3739
/// Use instead:
3840
/// ```no_run
39-
/// let v = vec![0];
41+
/// let v = vec![0, 1, 2];
4042
/// ```
4143
#[clippy::version = "1.51.0"]
4244
pub VEC_INIT_THEN_PUSH,

0 commit comments

Comments
 (0)