Skip to content

Commit

Permalink
more clippy
Browse files Browse the repository at this point in the history
Signed-off-by: Andrei Sandu <andrei-mihail@parity.io>
  • Loading branch information
sandreim committed Dec 14, 2023
1 parent bd128b3 commit 1021efb
Show file tree
Hide file tree
Showing 8 changed files with 20 additions and 23 deletions.
3 changes: 2 additions & 1 deletion polkadot/node/subsystem-bench/src/availability/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,8 @@ impl TestState {
candidate_receipt_templates.push(candidate_receipt);
}

let pov_sizes = config.pov_sizes().to_vec().into_iter().cycle();
let pov_sizes = config.pov_sizes().to_owned();
let pov_sizes = pov_sizes.into_iter().cycle();
gum::info!(target: LOG_TARGET, "{}","Created test environment.".bright_blue());

let mut _self = Self {
Expand Down
2 changes: 1 addition & 1 deletion polkadot/node/subsystem-bench/src/core/configuration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ pub struct TestSequence {
}

impl TestSequence {
pub fn to_vec(self) -> Vec<TestConfiguration> {
pub fn into_vec(self) -> Vec<TestConfiguration> {
self.test_configurations
.into_iter()
.map(|mut config| {
Expand Down
2 changes: 1 addition & 1 deletion polkadot/node/subsystem-bench/src/core/display.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ impl MetricCollection {
pub fn sum_by(&self, name: &str) -> f64 {
self.all()
.iter()
.filter(|metric| &metric.name == name)
.filter(|metric| metric.name == name)
.map(|metric| metric.value)
.sum()
}
Expand Down
8 changes: 4 additions & 4 deletions polkadot/node/subsystem-bench/src/core/mock/av_store.rs
Original file line number Diff line number Diff line change
Expand Up @@ -96,10 +96,10 @@ impl MockAvailabilityStore {
let msg = ctx.recv().await.expect("Overseer never fails us");

match msg {
orchestra::FromOrchestra::Signal(signal) => match signal {
OverseerSignal::Conclude => return,
_ => {},
},
orchestra::FromOrchestra::Signal(signal) =>
if signal == OverseerSignal::Conclude {
return
},
orchestra::FromOrchestra::Communication { msg } => match msg {
AvailabilityStoreMessage::QueryAvailableData(candidate_hash, tx) => {
gum::debug!(target: LOG_TARGET, candidate_hash = ?candidate_hash, "Responding to QueryAvailableData");
Expand Down
8 changes: 4 additions & 4 deletions polkadot/node/subsystem-bench/src/core/mock/network_bridge.rs
Original file line number Diff line number Diff line change
Expand Up @@ -287,10 +287,10 @@ impl MockNetworkBridgeTx {
let msg = ctx.recv().await.expect("Overseer never fails us");

match msg {
orchestra::FromOrchestra::Signal(signal) => match signal {
OverseerSignal::Conclude => return,
_ => {},
},
orchestra::FromOrchestra::Signal(signal) =>
if signal == OverseerSignal::Conclude {
return
},
orchestra::FromOrchestra::Communication { msg } => match msg {
NetworkBridgeTxMessage::SendRequests(requests, _if_disconnected) => {
for request in requests {
Expand Down
8 changes: 4 additions & 4 deletions polkadot/node/subsystem-bench/src/core/mock/runtime_api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,10 +84,10 @@ impl MockRuntimeApi {
let msg = ctx.recv().await.expect("Overseer never fails us");

match msg {
orchestra::FromOrchestra::Signal(signal) => match signal {
OverseerSignal::Conclude => return,
_ => {},
},
orchestra::FromOrchestra::Signal(signal) =>
if signal == OverseerSignal::Conclude {
return
},
orchestra::FromOrchestra::Communication { msg } => {
gum::debug!(target: LOG_TARGET, msg=?msg, "recv message");

Expand Down
10 changes: 3 additions & 7 deletions polkadot/node/subsystem-bench/src/core/network.rs
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ mod tests {
let mut reap_amount = 0;
while rate_limiter.total_ticks < tick_rate {
reap_amount += 1;
reap_amount = reap_amount % 100;
reap_amount %= 100;

rate_limiter.reap(reap_amount).await;
total_sent += reap_amount;
Expand Down Expand Up @@ -290,11 +290,7 @@ impl Peer {
}

pub fn is_connected(&self) -> bool {
if let Peer::Connected(_) = self {
true
} else {
false
}
matches!(self, Peer::Connected(_))
}

pub fn emulator(&mut self) -> &mut PeerEmulator {
Expand Down Expand Up @@ -333,7 +329,7 @@ impl NetworkEmulator {

// Create a `PeerEmulator` for each peer.
let (stats, mut peers): (_, Vec<_>) = (0..n_peers)
.zip(authorities.validator_authority_id.clone().into_iter())
.zip(authorities.validator_authority_id.clone())
.map(|(peer_index, authority_id)| {
validator_authority_id_mapping.insert(authority_id, peer_index);
let stats = Arc::new(PeerEmulatorStats::new(peer_index, metrics.clone()));
Expand Down
2 changes: 1 addition & 1 deletion polkadot/node/subsystem-bench/src/subsystem-bench.rs
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ impl BenchCli {
let test_sequence =
core::configuration::TestSequence::new_from_file(Path::new(&options.path))
.expect("File exists")
.to_vec();
.into_vec();
let num_steps = test_sequence.len();
gum::info!(
"{}",
Expand Down

0 comments on commit 1021efb

Please sign in to comment.