Skip to content

Commit 800c736

Browse files
committed
Add generic tests for try_fold
1 parent b864f48 commit 800c736

File tree

3 files changed

+6
-0
lines changed

3 files changed

+6
-0
lines changed

src/compile_fail/must_use.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ must_use! {
2727
flatten /** v.par_iter().flatten(); */
2828
fold /** v.par_iter().fold(|| 0, |x, _| x); */
2929
fold_with /** v.par_iter().fold_with(0, |x, _| x); */
30+
try_fold /** v.par_iter().try_fold(|| 0, |x, _| Some(x)); */
31+
try_fold_with /** v.par_iter().try_fold_with(0, |x, _| Some(x)); */
3032
inspect /** v.par_iter().inspect(|_| {}); */
3133
interleave /** v.par_iter().interleave(&v); */
3234
interleave_shortest /** v.par_iter().interleave_shortest(&v); */

tests/clones.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,8 @@ fn clone_adaptors() {
114114
check(v.par_iter().flatten());
115115
check(v.par_iter().with_max_len(1).fold(|| 0, |x, _| x));
116116
check(v.par_iter().with_max_len(1).fold_with(0, |x, _| x));
117+
check(v.par_iter().with_max_len(1).try_fold(|| 0, |_, &x| x));
118+
check(v.par_iter().with_max_len(1).try_fold_with(0, |_, &x| x));
117119
check(v.par_iter().inspect(|_| ()));
118120
check(v.par_iter().update(|_| ()));
119121
check(v.par_iter().interleave(&v));

tests/debug.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,8 @@ fn debug_adaptors() {
125125
check(v.par_iter().map(Some).flatten());
126126
check(v.par_iter().fold(|| 0, |x, _| x));
127127
check(v.par_iter().fold_with(0, |x, _| x));
128+
check(v.par_iter().try_fold(|| 0, |x, _| Some(x)));
129+
check(v.par_iter().try_fold_with(0, |x, _| Some(x)));
128130
check(v.par_iter().inspect(|_| ()));
129131
check(v.par_iter().update(|_| ()));
130132
check(v.par_iter().interleave(&v));

0 commit comments

Comments
 (0)