Skip to content

Commit 559583f

Browse files
wprzytulaLorak-mmk
authored andcommitted
raw_batch: Make RawBatchValuesIterator::count more elegant
Functional programming and iterators are the supreme, concise style!
1 parent 7734ff3 commit 559583f

File tree

1 file changed

+1
-5
lines changed

1 file changed

+1
-5
lines changed

scylla-cql/src/types/serialize/raw_batch.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -52,11 +52,7 @@ pub trait RawBatchValuesIterator<'a> {
5252
where
5353
Self: Sized,
5454
{
55-
let mut count = 0;
56-
while self.skip_next().is_some() {
57-
count += 1;
58-
}
59-
count
55+
std::iter::from_fn(|| self.skip_next()).count()
6056
}
6157
}
6258

0 commit comments

Comments
 (0)