Skip to content

Commit 1254af4

Browse files
phimuemuejswrenn
authored andcommitted
Fix clippy warning: Allow calling last on DoubleEndedIterators in tests
1 parent c679b8b commit 1254af4

File tree

3 files changed

+12
-2
lines changed

3 files changed

+12
-2
lines changed

tests/quick.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -450,7 +450,13 @@ quickcheck! {
450450
}
451451
assert_eq!(answer, actual);
452452

453-
assert_eq!(answer.into_iter().last(), a.multi_cartesian_product().last());
453+
assert_eq!(
454+
{
455+
#[allow(clippy::double_ended_iterator_last)]
456+
answer.into_iter().last()
457+
},
458+
a.multi_cartesian_product().last()
459+
);
454460
}
455461

456462
fn correct_empty_multi_product() -> () {

tests/specializations.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -503,7 +503,10 @@ quickcheck! {
503503
}
504504

505505
check_results_specialized!(it, |i| i.count());
506-
check_results_specialized!(it, |i| i.last());
506+
check_results_specialized!(it, |i| {
507+
#[allow(clippy::double_ended_iterator_last)]
508+
i.last()
509+
});
507510
check_results_specialized!(it, |i| i.collect::<Vec<_>>());
508511
check_results_specialized!(it, |i| i.rev().collect::<Vec<_>>());
509512
check_results_specialized!(it, |i| {

tests/test_core.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -281,6 +281,7 @@ fn count_clones() {
281281
let f = Foo { n: Cell::new(0) };
282282
let it = it::repeat_n(f, n);
283283
// drain it
284+
#[allow(clippy::double_ended_iterator_last)]
284285
let last = it.last();
285286
if n == 0 {
286287
assert_eq!(last, None);

0 commit comments

Comments
 (0)