2018-10-30 15:47:15 -05:00
|
|
|
error: slow zero-filling initialization
|
2019-01-07 15:33:18 -06:00
|
|
|
--> $DIR/slow_vector_initialization.rs:13:5
|
2018-10-18 18:15:48 -05:00
|
|
|
|
|
2018-12-27 09:57:55 -06:00
|
|
|
LL | let mut vec1 = Vec::with_capacity(len);
|
2018-10-30 15:47:15 -05:00
|
|
|
| ----------------------- help: consider replace allocation with: `vec![0; len]`
|
2018-12-27 09:57:55 -06:00
|
|
|
LL | vec1.extend(repeat(0).take(len));
|
2018-10-18 18:15:48 -05:00
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
2018-10-29 18:25:05 -05:00
|
|
|
|
|
|
|
|
= note: `-D clippy::slow-vector-initialization` implied by `-D warnings`
|
2018-10-18 18:15:48 -05:00
|
|
|
|
2018-10-30 15:47:15 -05:00
|
|
|
error: slow zero-filling initialization
|
2019-01-07 15:33:18 -06:00
|
|
|
--> $DIR/slow_vector_initialization.rs:17:5
|
2018-10-18 18:15:48 -05:00
|
|
|
|
|
2018-12-27 09:57:55 -06:00
|
|
|
LL | let mut vec2 = Vec::with_capacity(len - 10);
|
2018-10-30 15:47:15 -05:00
|
|
|
| ---------------------------- help: consider replace allocation with: `vec![0; len - 10]`
|
2018-12-27 09:57:55 -06:00
|
|
|
LL | vec2.extend(repeat(0).take(len - 10));
|
2018-10-18 18:15:48 -05:00
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
2018-10-30 15:47:15 -05:00
|
|
|
error: slow zero-filling initialization
|
2022-06-30 03:50:09 -05:00
|
|
|
--> $DIR/slow_vector_initialization.rs:24:5
|
|
|
|
|
|
|
|
|
LL | let mut vec4 = Vec::with_capacity(len);
|
|
|
|
| ----------------------- help: consider replace allocation with: `vec![0; len]`
|
|
|
|
LL | vec4.extend(repeat(0).take(vec4.capacity()));
|
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
error: slow zero-filling initialization
|
|
|
|
--> $DIR/slow_vector_initialization.rs:34:5
|
2018-10-18 18:15:48 -05:00
|
|
|
|
|
2018-12-27 09:57:55 -06:00
|
|
|
LL | let mut resized_vec = Vec::with_capacity(30);
|
2018-10-30 15:47:15 -05:00
|
|
|
| ---------------------- help: consider replace allocation with: `vec![0; 30]`
|
2018-12-27 09:57:55 -06:00
|
|
|
LL | resized_vec.resize(30, 0);
|
2018-10-18 18:15:48 -05:00
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
2018-10-30 15:47:15 -05:00
|
|
|
error: slow zero-filling initialization
|
2022-06-30 03:50:09 -05:00
|
|
|
--> $DIR/slow_vector_initialization.rs:37:5
|
2018-10-18 18:15:48 -05:00
|
|
|
|
|
2018-12-27 09:57:55 -06:00
|
|
|
LL | let mut extend_vec = Vec::with_capacity(30);
|
2018-10-30 15:47:15 -05:00
|
|
|
| ---------------------- help: consider replace allocation with: `vec![0; 30]`
|
2018-12-27 09:57:55 -06:00
|
|
|
LL | extend_vec.extend(repeat(0).take(30));
|
2018-10-18 18:15:48 -05:00
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
2018-10-30 15:47:15 -05:00
|
|
|
error: slow zero-filling initialization
|
2022-06-30 03:50:09 -05:00
|
|
|
--> $DIR/slow_vector_initialization.rs:44:5
|
2018-10-18 18:15:48 -05:00
|
|
|
|
|
2018-12-27 09:57:55 -06:00
|
|
|
LL | let mut vec1 = Vec::with_capacity(len);
|
2018-10-30 15:47:15 -05:00
|
|
|
| ----------------------- help: consider replace allocation with: `vec![0; len]`
|
2018-12-27 09:57:55 -06:00
|
|
|
LL | vec1.resize(len, 0);
|
2018-10-18 18:15:48 -05:00
|
|
|
| ^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
2018-10-30 15:47:15 -05:00
|
|
|
error: slow zero-filling initialization
|
2022-06-30 03:50:09 -05:00
|
|
|
--> $DIR/slow_vector_initialization.rs:52:5
|
2018-10-18 18:15:48 -05:00
|
|
|
|
|
2018-12-27 09:57:55 -06:00
|
|
|
LL | let mut vec3 = Vec::with_capacity(len - 10);
|
2018-10-30 15:47:15 -05:00
|
|
|
| ---------------------------- help: consider replace allocation with: `vec![0; len - 10]`
|
2018-12-27 09:57:55 -06:00
|
|
|
LL | vec3.resize(len - 10, 0);
|
2018-10-18 18:15:48 -05:00
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
2018-10-30 15:47:15 -05:00
|
|
|
error: slow zero-filling initialization
|
2022-06-30 03:50:09 -05:00
|
|
|
--> $DIR/slow_vector_initialization.rs:55:5
|
|
|
|
|
|
|
|
|
LL | let mut vec4 = Vec::with_capacity(len);
|
|
|
|
| ----------------------- help: consider replace allocation with: `vec![0; len]`
|
|
|
|
LL | vec4.resize(vec4.capacity(), 0);
|
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
error: slow zero-filling initialization
|
|
|
|
--> $DIR/slow_vector_initialization.rs:59:5
|
2018-10-18 18:15:48 -05:00
|
|
|
|
|
2018-12-27 09:57:55 -06:00
|
|
|
LL | vec1 = Vec::with_capacity(10);
|
2018-10-30 15:47:15 -05:00
|
|
|
| ---------------------- help: consider replace allocation with: `vec![0; 10]`
|
2018-12-27 09:57:55 -06:00
|
|
|
LL | vec1.resize(10, 0);
|
2018-10-18 18:15:48 -05:00
|
|
|
| ^^^^^^^^^^^^^^^^^^
|
|
|
|
|
2023-07-17 03:19:29 -05:00
|
|
|
error: this argument is a mutable reference, but not used mutably
|
|
|
|
--> $DIR/slow_vector_initialization.rs:62:18
|
|
|
|
|
|
|
|
|
LL | fn do_stuff(vec: &mut [u8]) {}
|
|
|
|
| ^^^^^^^^^ help: consider changing to: `&[u8]`
|
|
|
|
|
|
|
|
|
= note: `-D clippy::needless-pass-by-ref-mut` implied by `-D warnings`
|
|
|
|
|
|
|
|
error: aborting due to 10 previous errors
|
2018-10-18 18:15:48 -05:00
|
|
|
|