rust/tests/ui/slow_vector_initialization.stderr

74 lines
2.7 KiB
Plaintext

error: detected slow zero-filling initialization
--> $DIR/slow_vector_initialization.rs:23:5
|
22 | let mut vec1 = Vec::with_capacity(len);
| ----------------------- help: consider replacing with: `vec![0; ..]`
23 | vec1.extend(repeat(0).take(len));
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: `-D clippy::slow-vector-initialization` implied by `-D warnings`
error: detected slow zero-filling initialization
--> $DIR/slow_vector_initialization.rs:27:5
|
26 | let mut vec2 = Vec::with_capacity(len - 10);
| ---------------------------- help: consider replacing with: `vec![0; ..]`
27 | vec2.extend(repeat(0).take(len - 10));
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: detected slow zero-filling initialization
--> $DIR/slow_vector_initialization.rs:42:5
|
39 | let mut resized_vec = Vec::with_capacity(30);
| ---------------------- help: consider replacing with: `vec![0; ..]`
...
42 | resized_vec.resize(30, 0);
| ^^^^^^^^^^^^^^^^^^^^^^^^^
error: detected slow zero-filling initialization
--> $DIR/slow_vector_initialization.rs:44:5
|
40 | let mut extend_vec = Vec::with_capacity(30);
| ---------------------- help: consider replacing with: `vec![0; ..]`
...
44 | extend_vec.extend(repeat(0).take(30));
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: detected slow zero-filling initialization
--> $DIR/slow_vector_initialization.rs:51:5
|
50 | let mut vec1 = Vec::with_capacity(len);
| ----------------------- help: consider replacing with: `vec![0; ..]`
51 | vec1.resize(len, 0);
| ^^^^^^^^^^^^^^^^^^^
error: detected slow zero-filling initialization
--> $DIR/slow_vector_initialization.rs:59:5
|
58 | let mut vec3 = Vec::with_capacity(len - 10);
| ---------------------------- help: consider replacing with: `vec![0; ..]`
59 | vec3.resize(len - 10, 0);
| ^^^^^^^^^^^^^^^^^^^^^^^^
error: detected slow zero-filling initialization
--> $DIR/slow_vector_initialization.rs:63:5
|
62 | vec1 = Vec::with_capacity(10);
| ---------------------- help: consider replacing with: `vec![0; ..]`
63 | vec1.resize(10, 0);
| ^^^^^^^^^^^^^^^^^^
error: detected unsafe vector initialization
--> $DIR/slow_vector_initialization.rs:70:9
|
67 | let mut unsafe_vec: Vec<u8> = Vec::with_capacity(200);
| ----------------------- help: consider replacing with: `vec![0; ..]`
...
70 | unsafe_vec.set_len(200);
| ^^^^^^^^^^^^^^^^^^^^^^^
|
= note: #[deny(clippy::unsafe_vector_initialization)] on by default
error: aborting due to 8 previous errors