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

Commit

Permalink
fmt iteration
Browse files Browse the repository at this point in the history
  • Loading branch information
vstakhov committed Nov 21, 2022
1 parent 5771d35 commit 6109424
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 17 deletions.
2 changes: 1 addition & 1 deletion parachain/test-parachains/undying/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ pub fn execute(
hash_state(&block_data.state),
parent_head.post_state,
);
return Err(StateMismatch);
return Err(StateMismatch)
}

// We need to clone the block data as the fn will mutate it's state.
Expand Down
31 changes: 15 additions & 16 deletions runtime/parachains/src/hrmp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -713,7 +713,7 @@ impl<T: Config> Pallet<T> {
Some(req_data) => req_data,
None => {
// Can't normally happen but no need to panic.
continue;
continue
},
};

Expand Down Expand Up @@ -771,7 +771,7 @@ impl<T: Config> Pallet<T> {
fn process_hrmp_open_channel_requests(config: &HostConfiguration<T::BlockNumber>) {
let mut open_req_channels = <Self as Store>::HrmpOpenChannelRequestsList::get();
if open_req_channels.is_empty() {
return;
return
}

// iterate the vector starting from the end making our way to the beginning. This way we
Expand All @@ -780,7 +780,7 @@ impl<T: Config> Pallet<T> {
loop {
// bail if we've iterated over all items.
if idx == 0 {
break;
break
}

idx -= 1;
Expand All @@ -790,8 +790,8 @@ impl<T: Config> Pallet<T> {
);

if request.confirmed {
if <paras::Pallet<T>>::is_valid_para(channel_id.sender)
&& <paras::Pallet<T>>::is_valid_para(channel_id.recipient)
if <paras::Pallet<T>>::is_valid_para(channel_id.sender) &&
<paras::Pallet<T>>::is_valid_para(channel_id.recipient)
{
<Self as Store>::HrmpChannels::insert(
&channel_id,
Expand Down Expand Up @@ -891,14 +891,14 @@ impl<T: Config> Pallet<T> {
return Err(HrmpWatermarkAcceptanceErr::AdvancementRule {
new_watermark: new_hrmp_watermark,
last_watermark,
});
})
}
}
if new_hrmp_watermark > relay_chain_parent_number {
return Err(HrmpWatermarkAcceptanceErr::AheadRelayParent {
new_watermark: new_hrmp_watermark,
relay_chain_parent_number,
});
})
}

// Second, check where the watermark CAN land. It's one of the following:
Expand All @@ -915,7 +915,7 @@ impl<T: Config> Pallet<T> {
{
return Err(HrmpWatermarkAcceptanceErr::LandsOnBlockWithNoMessages {
new_watermark: new_hrmp_watermark,
});
})
}
Ok(())
}
Expand All @@ -930,7 +930,7 @@ impl<T: Config> Pallet<T> {
return Err(OutboundHrmpAcceptanceErr::MoreMessagesThanPermitted {
sent: out_hrmp_msgs.len() as u32,
permitted: config.hrmp_max_message_num_per_candidate,
});
})
}

let mut last_recipient = None::<ParaId>;
Expand All @@ -942,9 +942,8 @@ impl<T: Config> Pallet<T> {
// the messages must be sorted in ascending order and there must be no two messages sent
// to the same recipient. Thus we can check that every recipient is strictly greater than
// the previous one.
Some(last_recipient) if out_msg.recipient <= last_recipient => {
return Err(OutboundHrmpAcceptanceErr::NotSorted { idx })
},
Some(last_recipient) if out_msg.recipient <= last_recipient =>
return Err(OutboundHrmpAcceptanceErr::NotSorted { idx }),
_ => last_recipient = Some(out_msg.recipient),
}

Expand All @@ -961,7 +960,7 @@ impl<T: Config> Pallet<T> {
idx,
msg_size,
max_size: channel.max_message_size,
});
})
}

let new_total_size = channel.total_size + out_msg.data.len() as u32;
Expand All @@ -970,7 +969,7 @@ impl<T: Config> Pallet<T> {
idx,
total_size: new_total_size,
limit: channel.max_total_size,
});
})
}

let new_msg_count = channel.msg_count + 1;
Expand All @@ -979,7 +978,7 @@ impl<T: Config> Pallet<T> {
idx,
count: new_msg_count,
limit: channel.max_capacity,
});
})
}
}

Expand Down Expand Up @@ -1065,7 +1064,7 @@ impl<T: Config> Pallet<T> {
None => {
// apparently, that since acceptance of this candidate the recipient was
// offboarded and the channel no longer exists.
continue;
continue
},
};

Expand Down

0 comments on commit 6109424

Please sign in to comment.