Skip to content

Commit

Permalink
fix clippy (#1698)
Browse files Browse the repository at this point in the history
  • Loading branch information
svyatonik authored Dec 5, 2022
1 parent f78e886 commit 5cce3e8
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 28 deletions.
3 changes: 1 addition & 2 deletions bin/millau/node/src/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -199,8 +199,7 @@ pub fn new_full(mut config: Configuration) -> Result<TaskManager, ServiceError>
Ok(k) => keystore_container.set_remote_keystore(k),
Err(e) =>
return Err(ServiceError::Other(format!(
"Error hooking up remote keystore for {}: {}",
url, e
"Error hooking up remote keystore for {url}: {e}"
))),
};
}
Expand Down
18 changes: 4 additions & 14 deletions modules/messages/src/weights_ext.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,7 @@ pub fn ensure_able_to_receive_message<W: WeightInfoExt>(
max_incoming_message_proof_size.saturating_add(SIGNED_EXTENSIONS_SIZE);
assert!(
max_delivery_transaction_size <= max_extrinsic_size,
"Size of maximal message delivery transaction {} + {} is larger than maximal possible transaction size {}",
max_incoming_message_proof_size,
SIGNED_EXTENSIONS_SIZE,
max_extrinsic_size,
"Size of maximal message delivery transaction {max_incoming_message_proof_size} + {SIGNED_EXTENSIONS_SIZE} is larger than maximal possible transaction size {max_extrinsic_size}",
);

// verify that we're able to receive proof of maximal-size message with maximal dispatch weight
Expand All @@ -75,9 +72,7 @@ pub fn ensure_able_to_receive_message<W: WeightInfoExt>(
);
assert!(
max_delivery_transaction_dispatch_weight.all_lte(max_extrinsic_weight),
"Weight of maximal message delivery transaction + {} is larger than maximal possible transaction weight {}",
max_delivery_transaction_dispatch_weight,
max_extrinsic_weight,
"Weight of maximal message delivery transaction + {max_delivery_transaction_dispatch_weight} is larger than maximal possible transaction weight {max_extrinsic_weight}",
);
}

Expand All @@ -94,10 +89,7 @@ pub fn ensure_able_to_receive_confirmation<W: WeightInfoExt>(
max_inbound_lane_data_proof_size_from_peer_chain.saturating_add(SIGNED_EXTENSIONS_SIZE);
assert!(
max_confirmation_transaction_size <= max_extrinsic_size,
"Size of maximal message delivery confirmation transaction {} + {} is larger than maximal possible transaction size {}",
max_inbound_lane_data_proof_size_from_peer_chain,
SIGNED_EXTENSIONS_SIZE,
max_extrinsic_size,
"Size of maximal message delivery confirmation transaction {max_inbound_lane_data_proof_size_from_peer_chain} + {SIGNED_EXTENSIONS_SIZE} is larger than maximal possible transaction size {max_extrinsic_size}",
);

// verify that we're able to reward maximal number of relayers that have delivered maximal
Expand All @@ -112,9 +104,7 @@ pub fn ensure_able_to_receive_confirmation<W: WeightInfoExt>(
);
assert!(
max_confirmation_transaction_dispatch_weight.all_lte(max_extrinsic_weight),
"Weight of maximal confirmation transaction {} is larger than maximal possible transaction weight {}",
max_confirmation_transaction_dispatch_weight,
max_extrinsic_weight,
"Weight of maximal confirmation transaction {max_confirmation_transaction_dispatch_weight} is larger than maximal possible transaction weight {max_extrinsic_weight}",
);
}

Expand Down
6 changes: 1 addition & 5 deletions primitives/messages/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -408,11 +408,7 @@ mod tests {
let difference = (expected_size.unwrap() as f64 - actual_size as f64).abs();
assert!(
difference / (std::cmp::min(actual_size, expected_size.unwrap()) as f64) < 0.1,
"Too large difference between actual ({}) and expected ({:?}) inbound lane data size. Test case: {}+{}",
actual_size,
expected_size,
relayer_entries,
messages_count,
"Too large difference between actual ({actual_size}) and expected ({expected_size:?}) inbound lane data size. Test case: {relayer_entries}+{messages_count}",
);
}
}
Expand Down
2 changes: 1 addition & 1 deletion primitives/test-utils/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,7 @@ mod tests {

fn print_xcm<RuntimeCall>(xcm: &VersionedXcm<RuntimeCall>) {
println!("-----------------");
println!("xcm (plain): {:?}", xcm);
println!("xcm (plain): {xcm:?}");
println!("xcm (bytes): {:?}", xcm.encode());
println!("xcm (hex): {:?}", hexdisplay::HexDisplay::from(&xcm.encode()));
}
Expand Down
3 changes: 1 addition & 2 deletions relays/lib-substrate-relay/src/messages_source.rs
Original file line number Diff line number Diff line change
Expand Up @@ -495,8 +495,7 @@ fn validate_out_msgs_details<C: Chain>(
) -> Result<(), SubstrateError> {
let make_missing_nonce_error = |expected_nonce| {
Err(SubstrateError::Custom(format!(
"Missing nonce {} in message_details call result. Expected all nonces from {:?}",
expected_nonce, nonces,
"Missing nonce {expected_nonce} in message_details call result. Expected all nonces from {nonces:?}",
)))
};

Expand Down
6 changes: 2 additions & 4 deletions relays/lib-substrate-relay/src/parachains/source.rs
Original file line number Diff line number Diff line change
Expand Up @@ -147,8 +147,7 @@ where
let parachain = ParaId(P::SOURCE_PARACHAIN_PARA_ID);
if parachains != [parachain] {
return Err(SubstrateError::Custom(format!(
"Trying to prove unexpected parachains {:?}. Expected {:?}",
parachains, parachain,
"Trying to prove unexpected parachains {parachains:?}. Expected {parachain:?}",
)))
}

Expand Down Expand Up @@ -177,8 +176,7 @@ where
.transpose()?
.ok_or_else(|| {
SubstrateError::Custom(format!(
"Failed to read expected parachain {:?} head at {:?}",
parachain, at_block
"Failed to read expected parachain {parachain:?} head at {at_block:?}"
))
})?;
let parachain_head_hash = parachain_head.hash();
Expand Down

0 comments on commit 5cce3e8

Please sign in to comment.