Ensure cumulus/bridges is ignored by formatter and run it (#1369)

This commit is contained in:
Gavin Wood
2023-09-03 15:11:26 +02:00
committed by GitHub
parent 2c3e869c38
commit bc6fca3c44
7 changed files with 20 additions and 18 deletions
+2 -2
View File
@@ -19,9 +19,9 @@ trailing_comma = "Vertical"
trailing_semicolon = false trailing_semicolon = false
use_field_init_shorthand = true use_field_init_shorthand = true
ignore = [ ignore = [
"bridges", "cumulus/bridges",
] ]
edition = "2021" edition = "2021"
# Format comments # Format comments
comment_width = 100 comment_width = 100
wrap_comments = true wrap_comments = true
+8 -6
View File
@@ -943,9 +943,10 @@ where
peers: HashSet<Multiaddr>, peers: HashSet<Multiaddr>,
) -> Result<(), String> { ) -> Result<(), String> {
let Some(set_id) = self.notification_protocol_ids.get(&protocol) else { let Some(set_id) = self.notification_protocol_ids.get(&protocol) else {
return Err( return Err(format!(
format!("Cannot add peers to reserved set of unknown protocol: {}", protocol) "Cannot add peers to reserved set of unknown protocol: {}",
) protocol
))
}; };
let peers = self.split_multiaddr_and_peer_id(peers)?; let peers = self.split_multiaddr_and_peer_id(peers)?;
@@ -974,9 +975,10 @@ where
peers: Vec<PeerId>, peers: Vec<PeerId>,
) -> Result<(), String> { ) -> Result<(), String> {
let Some(set_id) = self.notification_protocol_ids.get(&protocol) else { let Some(set_id) = self.notification_protocol_ids.get(&protocol) else {
return Err( return Err(format!(
format!("Cannot remove peers from reserved set of unknown protocol: {}", protocol) "Cannot remove peers from reserved set of unknown protocol: {}",
) protocol
))
}; };
for peer_id in peers.into_iter() { for peer_id in peers.into_iter() {
@@ -462,7 +462,8 @@ where
follow_subscription: String, follow_subscription: String,
operation_id: String, operation_id: String,
) -> RpcResult<()> { ) -> RpcResult<()> {
let Some(operation) = self.subscriptions.get_operation(&follow_subscription, &operation_id) else { let Some(operation) = self.subscriptions.get_operation(&follow_subscription, &operation_id)
else {
return Ok(()) return Ok(())
}; };
@@ -479,7 +480,8 @@ where
follow_subscription: String, follow_subscription: String,
operation_id: String, operation_id: String,
) -> RpcResult<()> { ) -> RpcResult<()> {
let Some(operation) = self.subscriptions.get_operation(&follow_subscription, &operation_id) else { let Some(operation) = self.subscriptions.get_operation(&follow_subscription, &operation_id)
else {
return Ok(()) return Ok(())
}; };
@@ -166,9 +166,7 @@ where
let mut ret = Vec::with_capacity(self.operation_max_storage_items); let mut ret = Vec::with_capacity(self.operation_max_storage_items);
for _ in 0..self.operation_max_storage_items { for _ in 0..self.operation_max_storage_items {
let Some(key) = keys_iter.next() else { let Some(key) = keys_iter.next() else { break };
break
};
let result = match ty { let result = match ty {
IterQueryType::Value => self.query_storage_value(hash, &key, child_key), IterQueryType::Value => self.query_storage_value(hash, &key, child_key),
@@ -334,10 +334,10 @@ impl<T: Config> Pallet<T> {
contribution.length.saturating_dec(); contribution.length.saturating_dec();
let Some(mut pool_record) = InstaPoolHistory::<T>::get(r) else { let Some(mut pool_record) = InstaPoolHistory::<T>::get(r) else {
continue; continue
}; };
let Some(total_payout) = pool_record.maybe_payout else { let Some(total_payout) = pool_record.maybe_payout else {
break; break
}; };
let p = total_payout let p = total_payout
.saturating_mul(contributed_parts.into()) .saturating_mul(contributed_parts.into())
+2 -2
View File
@@ -96,7 +96,7 @@ impl<T: Config> Pallet<T> {
pub(crate) fn process_revenue() -> bool { pub(crate) fn process_revenue() -> bool {
let Some((until, amount)) = T::Coretime::check_notify_revenue_info() else { let Some((until, amount)) = T::Coretime::check_notify_revenue_info() else {
return false; return false
}; };
let when: Timeslice = let when: Timeslice =
(until / T::TimeslicePeriod::get()).saturating_sub(One::one()).saturated_into(); (until / T::TimeslicePeriod::get()).saturating_sub(One::one()).saturated_into();
@@ -290,7 +290,7 @@ impl<T: Config> Pallet<T> {
core: CoreIndex, core: CoreIndex,
) { ) {
let Some(workplan) = Workplan::<T>::take((timeslice, core)) else { let Some(workplan) = Workplan::<T>::take((timeslice, core)) else {
return; return
}; };
let workload = Workload::<T>::get(core); let workload = Workload::<T>::get(core);
let parts_used = workplan.iter().map(|i| i.mask).fold(CoreMask::void(), |a, i| a | i); let parts_used = workplan.iter().map(|i| i.mask).fold(CoreMask::void(), |a, i| a | i);
+1 -1
View File
@@ -398,7 +398,7 @@ pub mod pallet {
/// [`EnteredUntil`]. /// [`EnteredUntil`].
fn on_initialize(current: BlockNumberFor<T>) -> Weight { fn on_initialize(current: BlockNumberFor<T>) -> Weight {
let Some(limit) = EnteredUntil::<T>::get() else { let Some(limit) = EnteredUntil::<T>::get() else {
return T::WeightInfo::on_initialize_noop(); return T::WeightInfo::on_initialize_noop()
}; };
if current > limit { if current > limit {