Skip to content
This repository has been archived by the owner on Nov 6, 2020. It is now read-only.

fix(ManageNetwork): replace Range with RangeInclusive #10209

Merged
merged 3 commits into from
Jan 22, 2019

Conversation

niklasad1
Copy link
Collaborator

Fixes TODO: Range should be changed to RangeInclusive once stable (https://github.com/rust-lang/rust/pull/50758)

@niklasad1 niklasad1 added A0-pleasereview 🤓 Pull request needs code review. A2-insubstantial 👶 Pull request requires no code review (e.g., a sub-repository hash update). M4-core ⛓ Core client code / Rust. labels Jan 17, 2019
/// Note that `range.end` is *exclusive*.
// TODO: Range should be changed to RangeInclusive once stable (https://github.com/rust-lang/rust/pull/50758)
fn num_peers_range(&self) -> Range<u32>;
fn num_peers_range(&self) -> RangeInclusive<u32>;
/// Get network context for protocol.
Copy link
Collaborator Author

@niklasad1 niklasad1 Jan 17, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMHO, the return type RangeInclusive makes it clear that the range is inclusive thus I removed the comment

ethcore/sync/src/api.rs Outdated Show resolved Hide resolved
Fixes `TODO: Range should be changed to RangeInclusive once stable (https://github.com/rust-lang/rust/pull/50758)`
@niklasad1 niklasad1 force-pushed the network-make-peer-range-inclusive branch from 4a675b7 to f8f1adb Compare January 17, 2019 22:07
Copy link
Collaborator

@ordian ordian left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice! start(), end() are stable since Rust 1.27.

ethcore/sync/src/api.rs Outdated Show resolved Hide resolved
* RangeInclusive::end() is inclusive which means that if start and end is equal the `debug_assert(range.end() >
range.start()` will fail which is shouldn't
@ordian ordian added A8-looksgood 🦄 Pull request is reviewed well. and removed A0-pleasereview 🤓 Pull request needs code review. labels Jan 18, 2019
@ordian ordian added this to the 2.4 milestone Jan 18, 2019
@niklasad1 niklasad1 merged commit 4b11d79 into master Jan 22, 2019
@niklasad1 niklasad1 deleted the network-make-peer-range-inclusive branch January 22, 2019 08:51
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
A2-insubstantial 👶 Pull request requires no code review (e.g., a sub-repository hash update). A8-looksgood 🦄 Pull request is reviewed well. M4-core ⛓ Core client code / Rust.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants