blob: cb3ce3e95a7aff623bcd938760801b6ab3328707 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
|
error: slow zero-filling initialization
--> $DIR/slow_vector_initialization.rs:13:5
|
LL | let mut vec1 = Vec::with_capacity(len);
| ----------------------- help: consider replace allocation 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:17:5
|
LL | let mut vec2 = Vec::with_capacity(len - 10);
| ---------------------------- help: consider replace allocation with: `vec![0; len - 10]`
LL | vec2.extend(repeat(0).take(len - 10));
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: slow zero-filling initialization
--> $DIR/slow_vector_initialization.rs:24:5
|
LL | let mut vec4 = Vec::with_capacity(len);
| ----------------------- help: consider replace allocation with: `vec![0; len]`
LL | vec4.extend(repeat(0).take(vec4.capacity()));
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: slow zero-filling initialization
--> $DIR/slow_vector_initialization.rs:34:5
|
LL | let mut resized_vec = Vec::with_capacity(30);
| ---------------------- help: consider replace allocation with: `vec![0; 30]`
LL | resized_vec.resize(30, 0);
| ^^^^^^^^^^^^^^^^^^^^^^^^^
error: slow zero-filling initialization
--> $DIR/slow_vector_initialization.rs:37:5
|
LL | let mut extend_vec = Vec::with_capacity(30);
| ---------------------- help: consider replace allocation with: `vec![0; 30]`
LL | extend_vec.extend(repeat(0).take(30));
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: slow zero-filling initialization
--> $DIR/slow_vector_initialization.rs:44:5
|
LL | let mut vec1 = Vec::with_capacity(len);
| ----------------------- help: consider replace allocation with: `vec![0; len]`
LL | vec1.resize(len, 0);
| ^^^^^^^^^^^^^^^^^^^
error: slow zero-filling initialization
--> $DIR/slow_vector_initialization.rs:52:5
|
LL | let mut vec3 = Vec::with_capacity(len - 10);
| ---------------------------- help: consider replace allocation with: `vec![0; len - 10]`
LL | vec3.resize(len - 10, 0);
| ^^^^^^^^^^^^^^^^^^^^^^^^
error: slow zero-filling initialization
--> $DIR/slow_vector_initialization.rs:55:5
|
LL | let mut vec4 = Vec::with_capacity(len);
| ----------------------- help: consider replace allocation with: `vec![0; len]`
LL | vec4.resize(vec4.capacity(), 0);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: slow zero-filling initialization
--> $DIR/slow_vector_initialization.rs:59:5
|
LL | vec1 = Vec::with_capacity(10);
| ---------------------- help: consider replace allocation with: `vec![0; 10]`
LL | vec1.resize(10, 0);
| ^^^^^^^^^^^^^^^^^^
error: aborting due to 9 previous errors
|