rust/tests/ui/slow_vector_initialization.stderr
2023-08-22 17:18:11 +02:00

109 lines
4.1 KiB
Plaintext

error: slow zero-filling initialization
--> $DIR/slow_vector_initialization.rs:14:5
|
LL | let mut vec1 = Vec::with_capacity(len);
| ----------------------- help: consider replacing this with: `vec![0; len]`
LL | vec1.extend(repeat(0).take(len));
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: `-D clippy::slow-vector-initialization` implied by `-D warnings`
error: slow zero-filling initialization
--> $DIR/slow_vector_initialization.rs:20:5
|
LL | let mut vec2 = Vec::with_capacity(len - 10);
| ---------------------------- help: consider replacing this with: `vec![0; len - 10]`
LL | vec2.extend(repeat(0).take(len - 10));
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: slow zero-filling initialization
--> $DIR/slow_vector_initialization.rs:28:5
|
LL | let mut vec4 = Vec::with_capacity(len);
| ----------------------- help: consider replacing this with: `vec![0; len]`
LL | vec4.extend(repeat(0).take(vec4.capacity()));
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: slow zero-filling initialization
--> $DIR/slow_vector_initialization.rs:39:5
|
LL | let mut resized_vec = Vec::with_capacity(30);
| ---------------------- help: consider replacing this with: `vec![0; 30]`
LL | resized_vec.resize(30, 0);
| ^^^^^^^^^^^^^^^^^^^^^^^^^
error: slow zero-filling initialization
--> $DIR/slow_vector_initialization.rs:43:5
|
LL | let mut extend_vec = Vec::with_capacity(30);
| ---------------------- help: consider replacing this with: `vec![0; 30]`
LL | extend_vec.extend(repeat(0).take(30));
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: slow zero-filling initialization
--> $DIR/slow_vector_initialization.rs:51:5
|
LL | let mut vec1 = Vec::with_capacity(len);
| ----------------------- help: consider replacing this with: `vec![0; len]`
LL | vec1.resize(len, 0);
| ^^^^^^^^^^^^^^^^^^^
error: slow zero-filling initialization
--> $DIR/slow_vector_initialization.rs:60:5
|
LL | let mut vec3 = Vec::with_capacity(len - 10);
| ---------------------------- help: consider replacing this with: `vec![0; len - 10]`
LL | vec3.resize(len - 10, 0);
| ^^^^^^^^^^^^^^^^^^^^^^^^
error: slow zero-filling initialization
--> $DIR/slow_vector_initialization.rs:64:5
|
LL | let mut vec4 = Vec::with_capacity(len);
| ----------------------- help: consider replacing this with: `vec![0; len]`
LL | vec4.resize(vec4.capacity(), 0);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: slow zero-filling initialization
--> $DIR/slow_vector_initialization.rs:69:5
|
LL | vec1 = Vec::with_capacity(10);
| ---------------------- help: consider replacing this with: `vec![0; 10]`
LL | vec1.resize(10, 0);
| ^^^^^^^^^^^^^^^^^^
error: slow zero-filling initialization
--> $DIR/slow_vector_initialization.rs:77:5
|
LL | let mut vec1 = Vec::new();
| ---------- help: consider replacing this with: `vec![0; len]`
LL | vec1.resize(len, 0);
| ^^^^^^^^^^^^^^^^^^^
error: slow zero-filling initialization
--> $DIR/slow_vector_initialization.rs:82:5
|
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
--> $DIR/slow_vector_initialization.rs:87:5
|
LL | vec1 = Vec::new();
| ---------- help: consider replacing this with: `vec![0; 10]`
LL | vec1.resize(10, 0);
| ^^^^^^^^^^^^^^^^^^
error: this argument is a mutable reference, but not used mutably
--> $DIR/slow_vector_initialization.rs:91: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 13 previous errors