2018-10-30 21:47:15 +01:00
|
|
|
error: slow zero-filling initialization
|
2019-01-07 22:33:18 +01:00
|
|
|
--> $DIR/slow_vector_initialization.rs:13:5
|
2018-10-19 01:15:48 +02:00
|
|
|
|
|
2018-12-27 16:57:55 +01:00
|
|
|
LL | let mut vec1 = Vec::with_capacity(len);
|
2018-10-30 21:47:15 +01:00
|
|
|
| ----------------------- help: consider replace allocation with: `vec![0; len]`
|
2018-12-27 16:57:55 +01:00
|
|
|
LL | vec1.extend(repeat(0).take(len));
|
2018-10-19 01:15:48 +02:00
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
2018-10-30 00:25:05 +01:00
|
|
|
|
|
|
|
|
= note: `-D clippy::slow-vector-initialization` implied by `-D warnings`
|
2018-10-19 01:15:48 +02:00
|
|
|
|
2018-10-30 21:47:15 +01:00
|
|
|
error: slow zero-filling initialization
|
2019-01-07 22:33:18 +01:00
|
|
|
--> $DIR/slow_vector_initialization.rs:17:5
|
2018-10-19 01:15:48 +02:00
|
|
|
|
|
2018-12-27 16:57:55 +01:00
|
|
|
LL | let mut vec2 = Vec::with_capacity(len - 10);
|
2018-10-30 21:47:15 +01:00
|
|
|
| ---------------------------- help: consider replace allocation with: `vec![0; len - 10]`
|
2018-12-27 16:57:55 +01:00
|
|
|
LL | vec2.extend(repeat(0).take(len - 10));
|
2018-10-19 01:15:48 +02:00
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
2018-10-30 21:47:15 +01:00
|
|
|
error: slow zero-filling initialization
|
2019-01-07 22:33:18 +01:00
|
|
|
--> $DIR/slow_vector_initialization.rs:31:5
|
2018-10-19 01:15:48 +02:00
|
|
|
|
|
2018-12-27 16:57:55 +01:00
|
|
|
LL | let mut resized_vec = Vec::with_capacity(30);
|
2018-10-30 21:47:15 +01:00
|
|
|
| ---------------------- help: consider replace allocation with: `vec![0; 30]`
|
2018-12-27 16:57:55 +01:00
|
|
|
LL | resized_vec.resize(30, 0);
|
2018-10-19 01:15:48 +02:00
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
2018-10-30 21:47:15 +01:00
|
|
|
error: slow zero-filling initialization
|
2019-01-07 22:33:18 +01:00
|
|
|
--> $DIR/slow_vector_initialization.rs:34:5
|
2018-10-19 01:15:48 +02:00
|
|
|
|
|
2018-12-27 16:57:55 +01:00
|
|
|
LL | let mut extend_vec = Vec::with_capacity(30);
|
2018-10-30 21:47:15 +01:00
|
|
|
| ---------------------- help: consider replace allocation with: `vec![0; 30]`
|
2018-12-27 16:57:55 +01:00
|
|
|
LL | extend_vec.extend(repeat(0).take(30));
|
2018-10-19 01:15:48 +02:00
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
2018-10-30 21:47:15 +01:00
|
|
|
error: slow zero-filling initialization
|
2019-01-07 22:33:18 +01:00
|
|
|
--> $DIR/slow_vector_initialization.rs:41:5
|
2018-10-19 01:15:48 +02:00
|
|
|
|
|
2018-12-27 16:57:55 +01:00
|
|
|
LL | let mut vec1 = Vec::with_capacity(len);
|
2018-10-30 21:47:15 +01:00
|
|
|
| ----------------------- help: consider replace allocation with: `vec![0; len]`
|
2018-12-27 16:57:55 +01:00
|
|
|
LL | vec1.resize(len, 0);
|
2018-10-19 01:15:48 +02:00
|
|
|
| ^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
2018-10-30 21:47:15 +01:00
|
|
|
error: slow zero-filling initialization
|
2019-01-07 22:33:18 +01:00
|
|
|
--> $DIR/slow_vector_initialization.rs:49:5
|
2018-10-19 01:15:48 +02:00
|
|
|
|
|
2018-12-27 16:57:55 +01:00
|
|
|
LL | let mut vec3 = Vec::with_capacity(len - 10);
|
2018-10-30 21:47:15 +01:00
|
|
|
| ---------------------------- help: consider replace allocation with: `vec![0; len - 10]`
|
2018-12-27 16:57:55 +01:00
|
|
|
LL | vec3.resize(len - 10, 0);
|
2018-10-19 01:15:48 +02:00
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
2018-10-30 21:47:15 +01:00
|
|
|
error: slow zero-filling initialization
|
2019-01-07 22:33:18 +01:00
|
|
|
--> $DIR/slow_vector_initialization.rs:53:5
|
2018-10-19 01:15:48 +02:00
|
|
|
|
|
2018-12-27 16:57:55 +01:00
|
|
|
LL | vec1 = Vec::with_capacity(10);
|
2018-10-30 21:47:15 +01:00
|
|
|
| ---------------------- help: consider replace allocation with: `vec![0; 10]`
|
2018-12-27 16:57:55 +01:00
|
|
|
LL | vec1.resize(10, 0);
|
2018-10-19 01:15:48 +02:00
|
|
|
| ^^^^^^^^^^^^^^^^^^
|
|
|
|
|
2018-12-03 11:43:01 +01:00
|
|
|
error: aborting due to 7 previous errors
|
2018-10-19 01:15:48 +02:00
|
|
|
|