Skip to content

Commit

Permalink
raw_batch: Make RawBatchValuesIterator::count more elegant
Browse files Browse the repository at this point in the history
Functional programming and iterators are the supreme, concise style!
  • Loading branch information
wprzytula authored and Lorak-mmk committed Dec 7, 2024
1 parent 7734ff3 commit 559583f
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions scylla-cql/src/types/serialize/raw_batch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,7 @@ pub trait RawBatchValuesIterator<'a> {
where
Self: Sized,
{
let mut count = 0;
while self.skip_next().is_some() {
count += 1;
}
count
std::iter::from_fn(|| self.skip_next()).count()
}
}

Expand Down

0 comments on commit 559583f

Please sign in to comment.