File tree Expand file tree Collapse file tree 2 files changed +26
-2
lines changed Expand file tree Collapse file tree 2 files changed +26
-2
lines changed Original file line number Diff line number Diff line change 11#![ warn( clippy:: missing_iterator_fold) ]
22
3- fn main ( ) {
4- // test code goes here
3+ struct Countdown ( u8 ) ;
4+
5+ impl Iterator for Countdown {
6+ type Item = u8 ;
7+
8+ fn next ( & mut self ) -> Option < u8 > {
9+ self . 0 = self . 0 . checked_sub ( 1 ) ?;
10+ Some ( self . 0 )
11+ }
512}
Original file line number Diff line number Diff line change 1+ error: you are implementing `Iterator` without specializing its `fold` method
2+ --> $DIR/missing_iterator_fold.rs:5:1
3+ |
4+ LL | / impl Iterator for Countdown {
5+ LL | | type Item = u8;
6+ LL | |
7+ LL | | fn next(&mut self) -> Option<u8> {
8+ ... |
9+ LL | | }
10+ LL | | }
11+ | |_^
12+ |
13+ = note: `-D clippy::missing-iterator-fold` implied by `-D warnings`
14+ = help: to override `-D warnings` add `#[allow(clippy::missing_iterator_fold)]`
15+
16+ error: aborting due to 1 previous error
17+
You can’t perform that action at this time.
0 commit comments