2018-10-30 20:47:15 +00:00
|
|
|
error: slow zero-filling initialization
|
2018-12-03 10:43:01 +00:00
|
|
|
--> $DIR/slow_vector_initialization.rs:22:5
|
2018-10-18 23:15:48 +00:00
|
|
|
|
|
2018-12-03 10:43:01 +00:00
|
|
|
21 | let mut vec1 = Vec::with_capacity(len);
|
2018-10-30 20:47:15 +00:00
|
|
|
| ----------------------- help: consider replace allocation with: `vec![0; len]`
|
2018-12-03 10:43:01 +00:00
|
|
|
22 | vec1.extend(repeat(0).take(len));
|
2018-10-18 23:15:48 +00:00
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
2018-10-29 23:25:05 +00:00
|
|
|
|
|
|
|
|
= note: `-D clippy::slow-vector-initialization` implied by `-D warnings`
|
2018-10-18 23:15:48 +00:00
|
|
|
|
2018-10-30 20:47:15 +00:00
|
|
|
error: slow zero-filling initialization
|
2018-12-03 10:43:01 +00:00
|
|
|
--> $DIR/slow_vector_initialization.rs:26:5
|
2018-10-18 23:15:48 +00:00
|
|
|
|
|
2018-12-03 10:43:01 +00:00
|
|
|
25 | let mut vec2 = Vec::with_capacity(len - 10);
|
2018-10-30 20:47:15 +00:00
|
|
|
| ---------------------------- help: consider replace allocation with: `vec![0; len - 10]`
|
2018-12-03 10:43:01 +00:00
|
|
|
26 | vec2.extend(repeat(0).take(len - 10));
|
2018-10-18 23:15:48 +00:00
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
2018-10-30 20:47:15 +00:00
|
|
|
error: slow zero-filling initialization
|
2018-12-03 10:43:01 +00:00
|
|
|
--> $DIR/slow_vector_initialization.rs:40:5
|
2018-10-18 23:15:48 +00:00
|
|
|
|
|
2018-12-03 10:43:01 +00:00
|
|
|
39 | let mut resized_vec = Vec::with_capacity(30);
|
2018-10-30 20:47:15 +00:00
|
|
|
| ---------------------- help: consider replace allocation with: `vec![0; 30]`
|
2018-12-03 10:43:01 +00:00
|
|
|
40 | resized_vec.resize(30, 0);
|
2018-10-18 23:15:48 +00:00
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
2018-10-30 20:47:15 +00:00
|
|
|
error: slow zero-filling initialization
|
2018-12-03 10:43:01 +00:00
|
|
|
--> $DIR/slow_vector_initialization.rs:43:5
|
2018-10-18 23:15:48 +00:00
|
|
|
|
|
2018-12-03 10:43:01 +00:00
|
|
|
42 | let mut extend_vec = Vec::with_capacity(30);
|
2018-10-30 20:47:15 +00:00
|
|
|
| ---------------------- help: consider replace allocation with: `vec![0; 30]`
|
2018-12-03 10:43:01 +00:00
|
|
|
43 | extend_vec.extend(repeat(0).take(30));
|
2018-10-18 23:15:48 +00:00
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
2018-10-30 20:47:15 +00:00
|
|
|
error: slow zero-filling initialization
|
2018-12-03 10:43:01 +00:00
|
|
|
--> $DIR/slow_vector_initialization.rs:50:5
|
2018-10-18 23:15:48 +00:00
|
|
|
|
|
2018-12-03 10:43:01 +00:00
|
|
|
49 | let mut vec1 = Vec::with_capacity(len);
|
2018-10-30 20:47:15 +00:00
|
|
|
| ----------------------- help: consider replace allocation with: `vec![0; len]`
|
2018-12-03 10:43:01 +00:00
|
|
|
50 | vec1.resize(len, 0);
|
2018-10-18 23:15:48 +00:00
|
|
|
| ^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
2018-10-30 20:47:15 +00:00
|
|
|
error: slow zero-filling initialization
|
2018-12-03 10:43:01 +00:00
|
|
|
--> $DIR/slow_vector_initialization.rs:58:5
|
2018-10-18 23:15:48 +00:00
|
|
|
|
|
2018-12-03 10:43:01 +00:00
|
|
|
57 | let mut vec3 = Vec::with_capacity(len - 10);
|
2018-10-30 20:47:15 +00:00
|
|
|
| ---------------------------- help: consider replace allocation with: `vec![0; len - 10]`
|
2018-12-03 10:43:01 +00:00
|
|
|
58 | vec3.resize(len - 10, 0);
|
2018-10-18 23:15:48 +00:00
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
2018-10-30 20:47:15 +00:00
|
|
|
error: slow zero-filling initialization
|
2018-12-03 10:43:01 +00:00
|
|
|
--> $DIR/slow_vector_initialization.rs:62:5
|
2018-10-18 23:15:48 +00:00
|
|
|
|
|
2018-12-03 10:43:01 +00:00
|
|
|
61 | vec1 = Vec::with_capacity(10);
|
2018-10-30 20:47:15 +00:00
|
|
|
| ---------------------- help: consider replace allocation with: `vec![0; 10]`
|
2018-12-03 10:43:01 +00:00
|
|
|
62 | vec1.resize(10, 0);
|
2018-10-18 23:15:48 +00:00
|
|
|
| ^^^^^^^^^^^^^^^^^^
|
|
|
|
|
2018-12-03 10:43:01 +00:00
|
|
|
error: aborting due to 7 previous errors
|
2018-10-18 23:15:48 +00:00
|
|
|
|