Skip to content

Commit a76b09c

Browse files
Jules BertholetJules-Bertholet
Jules Bertholet
authored andcommitted
Consolidate slice iter impls into macro
1 parent 7ab8d4b commit a76b09c

File tree

4 files changed

+484
-844
lines changed

4 files changed

+484
-844
lines changed

library/alloc/tests/slice.rs

+8-5
Original file line numberDiff line numberDiff line change
@@ -1236,7 +1236,7 @@ fn test_rsplitnator() {
12361236

12371237
#[test]
12381238
fn test_split_iterators_size_hint() {
1239-
#[derive(Copy, Clone)]
1239+
#[derive(Copy, Clone, PartialEq, Eq)]
12401240
enum Bounds {
12411241
Lower,
12421242
Upper,
@@ -1267,8 +1267,9 @@ fn test_split_iterators_size_hint() {
12671267

12681268
// p: predicate, b: bound selection
12691269
for (p, b) in [
1270-
// with a predicate always returning false, the split*-iterators
1271-
// become maximally short, so the size_hint lower bounds are tight
1270+
// with a predicate always returning false, the non-inclusive
1271+
// split*-iterators become maximally short, so the size_hint
1272+
// lower bounds are tight
12721273
((|_| false) as fn(&_) -> _, Bounds::Lower),
12731274
// with a predicate always returning true, the split*-iterators
12741275
// become maximally long, so the size_hint upper bounds are tight
@@ -1279,8 +1280,10 @@ fn test_split_iterators_size_hint() {
12791280

12801281
a(v.split(p), b, "split");
12811282
a(v.split_mut(p), b, "split_mut");
1282-
a(v.split_inclusive(p), b, "split_inclusive");
1283-
a(v.split_inclusive_mut(p), b, "split_inclusive_mut");
1283+
if b == Bounds::Upper {
1284+
a(v.split_inclusive(p), b, "split_inclusive");
1285+
a(v.split_inclusive_mut(p), b, "split_inclusive_mut");
1286+
}
12841287
a(v.rsplit(p), b, "rsplit");
12851288
a(v.rsplit_mut(p), b, "rsplit_mut");
12861289

0 commit comments

Comments
 (0)