1
1
error: expression with side effects as the initial value in a zero-sized array initializer
2
- --> tests/ui/zero_repeat_side_effects.rs:16 :5
2
+ --> tests/ui/zero_repeat_side_effects.rs:17 :5
3
3
|
4
4
LL | let a = [f(); 0];
5
5
| ^^^^^^^^^^^^^^^^^
@@ -8,128 +8,134 @@ LL | let a = [f(); 0];
8
8
= help: to override `-D warnings` add `#[allow(clippy::zero_repeat_side_effects)]`
9
9
help: consider performing the side effect separately
10
10
|
11
- LL - let a = [ f(); 0] ;
12
- LL + f(); let a: [i32; 0] = [];
11
+ LL ~ f();
12
+ LL + let a: [i32; 0] = [];
13
13
|
14
14
15
15
error: expression with side effects as the initial value in a zero-sized array initializer
16
- --> tests/ui/zero_repeat_side_effects.rs:19 :5
16
+ --> tests/ui/zero_repeat_side_effects.rs:20 :5
17
17
|
18
18
LL | b = [f(); 0];
19
19
| ^^^^^^^^^^^^
20
20
|
21
21
help: consider performing the side effect separately
22
22
|
23
- LL - b = [ f(); 0] ;
24
- LL + f(); b = [] as [i32; 0];
23
+ LL ~ f();
24
+ LL ~ b = [] as [i32; 0];
25
25
|
26
26
27
27
error: expression with side effects as the initial value in a zero-sized array initializer
28
- --> tests/ui/zero_repeat_side_effects.rs:24 :5
28
+ --> tests/ui/zero_repeat_side_effects.rs:25 :5
29
29
|
30
30
LL | let c = vec![f(); 0];
31
31
| ^^^^^^^^^^^^^^^^^^^^^
32
32
|
33
33
help: consider performing the side effect separately
34
34
|
35
- LL - let c = vec![ f(); 0] ;
36
- LL + f(); let c: std::vec::Vec<i32> = vec![];
35
+ LL ~ f();
36
+ LL + let c: std::vec::Vec<i32> = vec![];
37
37
|
38
38
39
39
error: expression with side effects as the initial value in a zero-sized array initializer
40
- --> tests/ui/zero_repeat_side_effects.rs:27 :5
40
+ --> tests/ui/zero_repeat_side_effects.rs:28 :5
41
41
|
42
42
LL | d = vec![f(); 0];
43
43
| ^^^^^^^^^^^^^^^^
44
44
|
45
45
help: consider performing the side effect separately
46
46
|
47
- LL - d = vec![ f(); 0] ;
48
- LL + f(); d = vec![] as std::vec::Vec<i32>;
47
+ LL ~ f();
48
+ LL ~ d = vec![] as std::vec::Vec<i32>;
49
49
|
50
50
51
51
error: expression with side effects as the initial value in a zero-sized array initializer
52
- --> tests/ui/zero_repeat_side_effects.rs:31 :5
52
+ --> tests/ui/zero_repeat_side_effects.rs:32 :5
53
53
|
54
54
LL | let e = [println!("side effect"); 0];
55
55
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
56
56
|
57
57
help: consider performing the side effect separately
58
58
|
59
- LL - let e = [ println!("side effect"); 0] ;
60
- LL + println!("side effect"); let e: [(); 0] = [];
59
+ LL ~ println!("side effect");
60
+ LL + let e: [(); 0] = [];
61
61
|
62
62
63
63
error: expression with side effects as the initial value in a zero-sized array initializer
64
- --> tests/ui/zero_repeat_side_effects.rs:35 :5
64
+ --> tests/ui/zero_repeat_side_effects.rs:36 :5
65
65
|
66
66
LL | let g = [{ f() }; 0];
67
67
| ^^^^^^^^^^^^^^^^^^^^^
68
68
|
69
69
help: consider performing the side effect separately
70
70
|
71
- LL - let g = [ { f() }; 0] ;
72
- LL + { f() }; let g: [i32; 0] = [];
71
+ LL ~ { f() };
72
+ LL + let g: [i32; 0] = [];
73
73
|
74
74
75
75
error: expression with side effects as the initial value in a zero-sized array initializer
76
- --> tests/ui/zero_repeat_side_effects.rs:39 :10
76
+ --> tests/ui/zero_repeat_side_effects.rs:40 :10
77
77
|
78
78
LL | drop(vec![f(); 0]);
79
79
| ^^^^^^^^^^^^
80
80
|
81
81
help: consider performing the side effect separately
82
82
|
83
- LL - drop(vec![f(); 0]);
84
- LL + drop({ f(); vec![] as std::vec::Vec<i32> });
83
+ LL ~ drop({
84
+ LL + f();
85
+ LL + vec![] as std::vec::Vec<i32>
86
+ LL ~ });
85
87
|
86
88
87
89
error: expression with side effects as the initial value in a zero-sized array initializer
88
- --> tests/ui/zero_repeat_side_effects.rs:43 :5
90
+ --> tests/ui/zero_repeat_side_effects.rs:44 :5
89
91
|
90
92
LL | vec![f(); 0];
91
93
| ^^^^^^^^^^^^
92
94
|
93
95
help: consider performing the side effect separately
94
96
|
95
- LL - vec![ f(); 0] ;
96
- LL + { f(); vec![] as std::vec::Vec<i32> } ;
97
+ LL ~ f();
98
+ LL ~ vec![] as std::vec::Vec<i32>;
97
99
|
98
100
99
101
error: expression with side effects as the initial value in a zero-sized array initializer
100
- --> tests/ui/zero_repeat_side_effects.rs:45 :5
102
+ --> tests/ui/zero_repeat_side_effects.rs:46 :5
101
103
|
102
104
LL | [f(); 0];
103
105
| ^^^^^^^^
104
106
|
105
107
help: consider performing the side effect separately
106
108
|
107
- LL - [ f(); 0] ;
108
- LL + { f(); [] as [i32; 0] } ;
109
+ LL ~ f();
110
+ LL ~ [] as [i32; 0];
109
111
|
110
112
111
113
error: expression with side effects as the initial value in a zero-sized array initializer
112
- --> tests/ui/zero_repeat_side_effects.rs:99 :10
114
+ --> tests/ui/zero_repeat_side_effects.rs:100 :10
113
115
|
114
116
LL | foo(&[Some(f()); 0]);
115
117
| ^^^^^^^^^^^^^^
116
118
|
117
119
help: consider performing the side effect separately
118
120
|
119
- LL - foo(&[Some(f()); 0]);
120
- LL + foo(&{ Some(f()); [] as [std::option::Option<i32>; 0] });
121
+ LL ~ foo(&{
122
+ LL + Some(f());
123
+ LL + [] as [std::option::Option<i32>; 0]
124
+ LL ~ });
121
125
|
122
126
123
127
error: expression with side effects as the initial value in a zero-sized array initializer
124
- --> tests/ui/zero_repeat_side_effects.rs:101 :10
128
+ --> tests/ui/zero_repeat_side_effects.rs:102 :10
125
129
|
126
130
LL | foo(&[Some(Some(S::new())); 0]);
127
131
| ^^^^^^^^^^^^^^^^^^^^^^^^^
128
132
|
129
133
help: consider performing the side effect separately
130
134
|
131
- LL - foo(&[Some(Some(S::new())); 0]);
132
- LL + foo(&{ Some(Some(S::new())); [] as [std::option::Option<std::option::Option<S>>; 0] });
135
+ LL ~ foo(&{
136
+ LL + Some(Some(S::new()));
137
+ LL + [] as [std::option::Option<std::option::Option<S>>; 0]
138
+ LL ~ });
133
139
|
134
140
135
141
error: aborting due to 11 previous errors
0 commit comments