Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introduce function/trait method to compute number of messages in the range #2032

Closed
svyatonik opened this issue Apr 12, 2023 · 0 comments · Fixed by #2037
Closed

Introduce function/trait method to compute number of messages in the range #2032

svyatonik opened this issue Apr 12, 2023 · 0 comments · Fixed by #2037
Assignees
Labels
A-chores Something that has to be done, as part of regular maintenance

Comments

@svyatonik
Copy link
Contributor

#2031 (review)

ExactSizeIterator is not implemented for RangeInclusive<u64>, so we can't use .len(). .count() is probably ineffective (but actually maybe rust compiler is smart enough to optimize that?). So we're using construct like this:

					received_range
						.end()
						.checked_sub(*received_range.start())
						.and_then(|x| x.checked_add(1))
						.unwrap_or(<something-else>),

Let's extract all except the unwrap_or() to a separate function/trait method and use it across the code.

@svyatonik svyatonik added the A-chores Something that has to be done, as part of regular maintenance label Apr 12, 2023
@svyatonik svyatonik added this to the When Thou Have Spare Hour milestone Apr 12, 2023
@serban300 serban300 self-assigned this Apr 12, 2023
svyatonik pushed a commit that referenced this issue Jul 17, 2023
Bumps [clap](https://github.com/clap-rs/clap) from 4.0.29 to 4.0.32.
- [Release notes](https://github.com/clap-rs/clap/releases)
- [Changelog](https://github.com/clap-rs/clap/blob/master/CHANGELOG.md)
- [Commits](clap-rs/clap@v4.0.29...v4.0.32)

---
updated-dependencies:
- dependency-name: clap
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <[email protected]>

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-chores Something that has to be done, as part of regular maintenance
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants