2018-10-30 20:47:15 +00:00
|
|
|
error: slow zero-filling initialization
|
2024-02-27 14:25:18 +00:00
|
|
|
--> tests/ui/slow_vector_initialization.rs:14:5
|
2018-10-18 23:15:48 +00:00
|
|
|
|
|
2018-12-27 15:57:55 +00:00
|
|
|
LL | let mut vec1 = Vec::with_capacity(len);
|
2023-07-31 21:53:53 +00:00
|
|
|
| ----------------------- help: consider replacing this with: `vec![0; len]`
|
2018-12-27 15:57:55 +00:00
|
|
|
LL | 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`
|
2023-08-01 12:02:21 +00:00
|
|
|
= help: to override `-D warnings` add `#[allow(clippy::slow_vector_initialization)]`
|
2018-10-18 23:15:48 +00:00
|
|
|
|
2018-10-30 20:47:15 +00:00
|
|
|
error: slow zero-filling initialization
|
2024-02-27 14:25:18 +00:00
|
|
|
--> tests/ui/slow_vector_initialization.rs:20:5
|
2018-10-18 23:15:48 +00:00
|
|
|
|
|
2018-12-27 15:57:55 +00:00
|
|
|
LL | let mut vec2 = Vec::with_capacity(len - 10);
|
2023-07-31 21:53:53 +00:00
|
|
|
| ---------------------------- help: consider replacing this with: `vec![0; len - 10]`
|
2018-12-27 15:57:55 +00:00
|
|
|
LL | 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
|
2024-02-27 14:25:18 +00:00
|
|
|
--> tests/ui/slow_vector_initialization.rs:28:5
|
2022-06-30 08:50:09 +00:00
|
|
|
|
|
|
|
|
LL | let mut vec4 = Vec::with_capacity(len);
|
2023-07-31 21:53:53 +00:00
|
|
|
| ----------------------- help: consider replacing this with: `vec![0; len]`
|
2022-06-30 08:50:09 +00:00
|
|
|
LL | vec4.extend(repeat(0).take(vec4.capacity()));
|
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
error: slow zero-filling initialization
|
2024-02-27 14:25:18 +00:00
|
|
|
--> tests/ui/slow_vector_initialization.rs:39:5
|
2018-10-18 23:15:48 +00:00
|
|
|
|
|
2018-12-27 15:57:55 +00:00
|
|
|
LL | let mut resized_vec = Vec::with_capacity(30);
|
2023-07-31 21:53:53 +00:00
|
|
|
| ---------------------- help: consider replacing this with: `vec![0; 30]`
|
2018-12-27 15:57:55 +00:00
|
|
|
LL | 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
|
2024-02-27 14:25:18 +00:00
|
|
|
--> tests/ui/slow_vector_initialization.rs:43:5
|
2018-10-18 23:15:48 +00:00
|
|
|
|
|
2018-12-27 15:57:55 +00:00
|
|
|
LL | let mut extend_vec = Vec::with_capacity(30);
|
2023-07-31 21:53:53 +00:00
|
|
|
| ---------------------- help: consider replacing this with: `vec![0; 30]`
|
2018-12-27 15:57:55 +00:00
|
|
|
LL | 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
|
2024-02-27 14:25:18 +00:00
|
|
|
--> tests/ui/slow_vector_initialization.rs:51:5
|
2018-10-18 23:15:48 +00:00
|
|
|
|
|
2018-12-27 15:57:55 +00:00
|
|
|
LL | let mut vec1 = Vec::with_capacity(len);
|
2023-07-31 21:53:53 +00:00
|
|
|
| ----------------------- help: consider replacing this with: `vec![0; len]`
|
2018-12-27 15:57:55 +00:00
|
|
|
LL | 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
|
2024-02-27 14:25:18 +00:00
|
|
|
--> tests/ui/slow_vector_initialization.rs:60:5
|
2018-10-18 23:15:48 +00:00
|
|
|
|
|
2018-12-27 15:57:55 +00:00
|
|
|
LL | let mut vec3 = Vec::with_capacity(len - 10);
|
2023-07-31 21:53:53 +00:00
|
|
|
| ---------------------------- help: consider replacing this with: `vec![0; len - 10]`
|
2018-12-27 15:57:55 +00:00
|
|
|
LL | 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
|
2024-02-27 14:25:18 +00:00
|
|
|
--> tests/ui/slow_vector_initialization.rs:64:5
|
2022-06-30 08:50:09 +00:00
|
|
|
|
|
|
|
|
LL | let mut vec4 = Vec::with_capacity(len);
|
2023-07-31 21:53:53 +00:00
|
|
|
| ----------------------- help: consider replacing this with: `vec![0; len]`
|
2022-06-30 08:50:09 +00:00
|
|
|
LL | vec4.resize(vec4.capacity(), 0);
|
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
error: slow zero-filling initialization
|
2024-02-27 14:25:18 +00:00
|
|
|
--> tests/ui/slow_vector_initialization.rs:69:5
|
2018-10-18 23:15:48 +00:00
|
|
|
|
|
2018-12-27 15:57:55 +00:00
|
|
|
LL | vec1 = Vec::with_capacity(10);
|
2023-07-31 21:53:53 +00:00
|
|
|
| ---------------------- help: consider replacing this with: `vec![0; 10]`
|
|
|
|
LL | vec1.resize(10, 0);
|
|
|
|
| ^^^^^^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
error: slow zero-filling initialization
|
2024-02-27 14:25:18 +00:00
|
|
|
--> tests/ui/slow_vector_initialization.rs:77:5
|
2023-07-31 21:53:53 +00:00
|
|
|
|
|
|
|
|
LL | let mut vec1 = Vec::new();
|
|
|
|
| ---------- help: consider replacing this with: `vec![0; len]`
|
|
|
|
LL | vec1.resize(len, 0);
|
|
|
|
| ^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
error: slow zero-filling initialization
|
2024-02-27 14:25:18 +00:00
|
|
|
--> tests/ui/slow_vector_initialization.rs:82:5
|
2023-07-31 21:53:53 +00:00
|
|
|
|
|
|
|
|
LL | let mut vec3 = Vec::new();
|
|
|
|
| ---------- help: consider replacing this with: `vec![0; len - 10]`
|
|
|
|
LL | vec3.resize(len - 10, 0);
|
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
error: slow zero-filling initialization
|
2024-02-27 14:25:18 +00:00
|
|
|
--> tests/ui/slow_vector_initialization.rs:87:5
|
2023-07-31 21:53:53 +00:00
|
|
|
|
|
|
|
|
LL | vec1 = Vec::new();
|
|
|
|
| ---------- help: consider replacing this with: `vec![0; 10]`
|
2018-12-27 15:57:55 +00:00
|
|
|
LL | vec1.resize(10, 0);
|
2018-10-18 23:15:48 +00:00
|
|
|
| ^^^^^^^^^^^^^^^^^^
|
|
|
|
|
2023-09-12 16:13:53 +00:00
|
|
|
error: slow zero-filling initialization
|
2024-02-27 14:25:18 +00:00
|
|
|
--> tests/ui/slow_vector_initialization.rs:91:5
|
2023-09-12 16:13:53 +00:00
|
|
|
|
|
|
|
|
LL | vec1 = vec![];
|
|
|
|
| ------ help: consider replacing this with: `vec![0; 10]`
|
|
|
|
LL | vec1.resize(10, 0);
|
|
|
|
| ^^^^^^^^^^^^^^^^^^
|
|
|
|
|
2023-10-06 15:35:45 +00:00
|
|
|
error: aborting due to 13 previous errors
|
2018-10-18 23:15:48 +00:00
|
|
|
|