fix(ManageNetwork): replace Range with RangeInclusive (#10209)
* fix(ManageNetwork): replace Range -> RangeIncls Fixes `TODO: Range should be changed to RangeInclusive once stable (https://github.com/rust-lang/rust/pull/50758)` * fix(tests) * fix(grumbles): off-by-one error in debug_asserts * 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
This commit is contained in:
@@ -20,7 +20,7 @@ use host::Host;
|
||||
use io::*;
|
||||
use parking_lot::RwLock;
|
||||
use std::net::SocketAddr;
|
||||
use std::ops::Range;
|
||||
use std::ops::RangeInclusive;
|
||||
use std::sync::Arc;
|
||||
use ansi_term::Colour;
|
||||
use network::ConnectionFilter;
|
||||
@@ -95,12 +95,8 @@ impl NetworkService {
|
||||
}
|
||||
|
||||
/// Returns the number of peers allowed.
|
||||
///
|
||||
/// Keep in mind that `range.end` is *exclusive*.
|
||||
pub fn num_peers_range(&self) -> Range<u32> {
|
||||
let start = self.config.min_peers;
|
||||
let end = self.config.max_peers + 1;
|
||||
start .. end
|
||||
pub fn num_peers_range(&self) -> RangeInclusive<u32> {
|
||||
self.config.min_peers..=self.config.max_peers
|
||||
}
|
||||
|
||||
/// Returns external url if available.
|
||||
|
||||
Reference in New Issue
Block a user