Skip to content

Commit 9ced0f5

Browse files
committed
use note_once
This is a general advice, and so shouldn't be repeated
1 parent 6a14a52 commit 9ced0f5

File tree

3 files changed

+1
-24
lines changed

3 files changed

+1
-24
lines changed

clippy_lints/src/missing_asserts_for_indexing.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ where
7676
for span in indexes {
7777
diag.span_note(span, "slice indexed here");
7878
}
79-
diag.note("asserting the length before indexing will elide bounds checks");
79+
diag.note_once("asserting the length before indexing will elide bounds checks");
8080
});
8181
}
8282

tests/ui/missing_asserts_for_indexing.stderr

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,6 @@ note: slice indexed here
6868
|
6969
LL | v[0] + v[1] + v[2] + v[3] + v[4]
7070
| ^^^^
71-
= note: asserting the length before indexing will elide bounds checks
7271

7372
error: indexing into a slice multiple times with an `assert` that does not cover the highest index
7473
--> tests/ui/missing_asserts_for_indexing.rs:42:5
@@ -103,7 +102,6 @@ note: slice indexed here
103102
|
104103
LL | v[0] + v[1] + v[2] + v[3] + v[4]
105104
| ^^^^
106-
= note: asserting the length before indexing will elide bounds checks
107105

108106
error: indexing into a slice multiple times with an `assert` that does not cover the highest index
109107
--> tests/ui/missing_asserts_for_indexing.rs:48:5
@@ -138,7 +136,6 @@ note: slice indexed here
138136
|
139137
LL | v[0] + v[1] + v[2] + v[3] + v[4]
140138
| ^^^^
141-
= note: asserting the length before indexing will elide bounds checks
142139

143140
error: indexing into a slice multiple times with an `assert` that does not cover the highest index
144141
--> tests/ui/missing_asserts_for_indexing.rs:66:13
@@ -161,7 +158,6 @@ note: slice indexed here
161158
|
162159
LL | let _ = v[1..4];
163160
| ^^^^^^^
164-
= note: asserting the length before indexing will elide bounds checks
165161

166162
error: indexing into a slice multiple times with an `assert` that does not cover the highest index
167163
--> tests/ui/missing_asserts_for_indexing.rs:81:13
@@ -184,7 +180,6 @@ note: slice indexed here
184180
|
185181
LL | let _ = v[1..=4];
186182
| ^^^^^^^^
187-
= note: asserting the length before indexing will elide bounds checks
188183

189184
error: indexing into a slice multiple times with an `assert` that does not cover the highest index
190185
--> tests/ui/missing_asserts_for_indexing.rs:97:13
@@ -205,7 +200,6 @@ note: slice indexed here
205200
|
206201
LL | let _ = v1[0] + v1[12];
207202
| ^^^^^^
208-
= note: asserting the length before indexing will elide bounds checks
209203

210204
error: indexing into a slice multiple times with an `assert` that does not cover the highest index
211205
--> tests/ui/missing_asserts_for_indexing.rs:100:13
@@ -226,7 +220,6 @@ note: slice indexed here
226220
|
227221
LL | let _ = v2[5] + v2[15];
228222
| ^^^^^^
229-
= note: asserting the length before indexing will elide bounds checks
230223

231224
error: indexing into a slice multiple times with an `assert` that does not cover the highest index
232225
--> tests/ui/missing_asserts_for_indexing.rs:106:13
@@ -247,7 +240,6 @@ note: slice indexed here
247240
|
248241
LL | let _ = v1[0] + v1[12];
249242
| ^^^^^^
250-
= note: asserting the length before indexing will elide bounds checks
251243

252244
error: indexing into a slice multiple times with an `assert` that does not cover the highest index
253245
--> tests/ui/missing_asserts_for_indexing.rs:131:13
@@ -273,7 +265,6 @@ note: slice indexed here
273265
|
274266
LL | let _ = v1[0] + v1[1] + v1[2];
275267
| ^^^^^
276-
= note: asserting the length before indexing will elide bounds checks
277268

278269
error: indexing into a slice multiple times with an `assert` that does not cover the highest index
279270
--> tests/ui/missing_asserts_for_indexing.rs:136:13
@@ -299,7 +290,6 @@ note: slice indexed here
299290
|
300291
LL | let _ = v3[0] + v3[1] + v3[2];
301292
| ^^^^^
302-
= note: asserting the length before indexing will elide bounds checks
303293

304294
error: indexing into a slice multiple times with an `assert` that does not cover the highest index
305295
--> tests/ui/missing_asserts_for_indexing.rs:158:13
@@ -325,7 +315,6 @@ note: slice indexed here
325315
|
326316
LL | let _ = v1[0] + v1[1] + v1[2];
327317
| ^^^^^
328-
= note: asserting the length before indexing will elide bounds checks
329318

330319
error: indexing into a slice multiple times with an `assert` that does not cover the highest index
331320
--> tests/ui/missing_asserts_for_indexing.rs:163:13
@@ -351,7 +340,6 @@ note: slice indexed here
351340
|
352341
LL | let _ = v3[0] + v3[1] + v3[2];
353342
| ^^^^^
354-
= note: asserting the length before indexing will elide bounds checks
355343

356344
error: indexing into a slice multiple times with an `assert` that does not cover the highest index
357345
--> tests/ui/missing_asserts_for_indexing.rs:172:17
@@ -376,7 +364,6 @@ note: slice indexed here
376364
|
377365
LL | let _ = v[0] + v[1] + v[2];
378366
| ^^^^
379-
= note: asserting the length before indexing will elide bounds checks
380367

381368
error: indexing into a slice multiple times with an `assert` that does not cover the highest index
382369
--> tests/ui/missing_asserts_for_indexing.rs:178:17
@@ -401,7 +388,6 @@ note: slice indexed here
401388
|
402389
LL | let _ = v[0] + v[1] + v[2];
403390
| ^^^^
404-
= note: asserting the length before indexing will elide bounds checks
405391

406392
error: aborting due to 15 previous errors
407393

tests/ui/missing_asserts_for_indexing_unfixable.stderr

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,6 @@ note: slice indexed here
5454
|
5555
LL | let _ = v[1..4];
5656
| ^^^^^^^
57-
= note: asserting the length before indexing will elide bounds checks
5857

5958
error: indexing into a slice multiple times without an `assert`
6059
--> tests/ui/missing_asserts_for_indexing_unfixable.rs:17:13
@@ -83,7 +82,6 @@ note: slice indexed here
8382
|
8483
LL | let c = v[2];
8584
| ^^^^
86-
= note: asserting the length before indexing will elide bounds checks
8785

8886
error: indexing into a slice multiple times without an `assert`
8987
--> tests/ui/missing_asserts_for_indexing_unfixable.rs:26:13
@@ -102,7 +100,6 @@ note: slice indexed here
102100
|
103101
LL | let _ = v1[0] + v1[12];
104102
| ^^^^^^
105-
= note: asserting the length before indexing will elide bounds checks
106103

107104
error: indexing into a slice multiple times without an `assert`
108105
--> tests/ui/missing_asserts_for_indexing_unfixable.rs:28:13
@@ -121,7 +118,6 @@ note: slice indexed here
121118
|
122119
LL | let _ = v2[5] + v2[15];
123120
| ^^^^^^
124-
= note: asserting the length before indexing will elide bounds checks
125121

126122
error: indexing into a slice multiple times without an `assert`
127123
--> tests/ui/missing_asserts_for_indexing_unfixable.rs:35:13
@@ -140,7 +136,6 @@ note: slice indexed here
140136
|
141137
LL | let _ = v2[5] + v2[15];
142138
| ^^^^^^
143-
= note: asserting the length before indexing will elide bounds checks
144139

145140
error: indexing into a slice multiple times without an `assert`
146141
--> tests/ui/missing_asserts_for_indexing_unfixable.rs:45:13
@@ -159,7 +154,6 @@ note: slice indexed here
159154
|
160155
LL | let _ = f.v[0] + f.v[1];
161156
| ^^^^^^
162-
= note: asserting the length before indexing will elide bounds checks
163157

164158
error: indexing into a slice multiple times without an `assert`
165159
--> tests/ui/missing_asserts_for_indexing_unfixable.rs:59:13
@@ -178,7 +172,6 @@ note: slice indexed here
178172
|
179173
LL | let _ = x[0] + x[1];
180174
| ^^^^
181-
= note: asserting the length before indexing will elide bounds checks
182175

183176
error: indexing into a slice multiple times without an `assert`
184177
--> tests/ui/missing_asserts_for_indexing_unfixable.rs:77:13
@@ -197,7 +190,6 @@ note: slice indexed here
197190
|
198191
LL | let _ = v1[1] + v1[2];
199192
| ^^^^^
200-
= note: asserting the length before indexing will elide bounds checks
201193

202194
error: indexing into a slice multiple times without an `assert`
203195
--> tests/ui/missing_asserts_for_indexing_unfixable.rs:85:13
@@ -221,7 +213,6 @@ note: slice indexed here
221213
|
222214
LL | let _ = v1[0] + v1[1] + v1[2];
223215
| ^^^^^
224-
= note: asserting the length before indexing will elide bounds checks
225216

226217
error: aborting due to 10 previous errors
227218

0 commit comments

Comments
 (0)