From b26aa98d1ea64583a3498a27a1e29efae237f38f Mon Sep 17 00:00:00 2001 From: Svyatoslav Nikolsky Date: Fri, 28 Jul 2023 12:57:34 +0300 Subject: [PATCH] fixing spellcheck, clippy and rustdoc --- .../src/messages_xcm_extension.rs | 22 ++++++++++--------- modules/xcm-bridge-hub-router/src/lib.rs | 7 ++---- modules/xcm-bridge-hub-router/src/mock.rs | 2 +- primitives/messages/src/target_chain.rs | 2 +- 4 files changed, 16 insertions(+), 17 deletions(-) diff --git a/bin/runtime-common/src/messages_xcm_extension.rs b/bin/runtime-common/src/messages_xcm_extension.rs index 8f2ee3ad350..eb2e206f323 100644 --- a/bin/runtime-common/src/messages_xcm_extension.rs +++ b/bin/runtime-common/src/messages_xcm_extension.rs @@ -207,7 +207,7 @@ impl LocalXcmQueueManager { } } -/// A structure that implements [`frame_support:traits::messages::ProcessMessage`] and may +/// A structure that implements [`frame_support::traits::ProcessMessage`] and may /// be used in the `pallet-message-queue` configuration to stop processing messages when the /// bridge queue is congested. /// @@ -243,10 +243,11 @@ where ) -> Result { // if the queue is suspended, yield immediately let sender_and_lane = SL::get(); - if origin.clone().into() == sender_and_lane.location { - if LocalXcmQueueManager::is_inbound_queue_suspended::(sender_and_lane.lane) { - return Err(ProcessMessageError::Yield) - } + let is_expected_origin = origin.clone().into() == sender_and_lane.location; + if is_expected_origin && + LocalXcmQueueManager::is_inbound_queue_suspended::(sender_and_lane.lane) + { + return Err(ProcessMessageError::Yield) } // else pass message to backed processor @@ -254,7 +255,7 @@ where } } -/// A structure that implements [`frame_support:traits::messages::QueuePausedQuery`] and may +/// A structure that implements [`frame_support::traits::QueuePausedQuery`] and may /// be used in the `pallet-message-queue` configuration to stop processing messages when the /// bridge queue is congested. /// @@ -280,10 +281,11 @@ where // if we have suspended the queue before, do not even start processing its messages let sender_and_lane = SL::get(); - if origin.clone().into() == sender_and_lane.location { - if LocalXcmQueueManager::is_inbound_queue_suspended::(sender_and_lane.lane) { - return true - } + let is_expected_origin = origin.clone().into() == sender_and_lane.location; + if is_expected_origin && + LocalXcmQueueManager::is_inbound_queue_suspended::(sender_and_lane.lane) + { + return true } // else process message diff --git a/modules/xcm-bridge-hub-router/src/lib.rs b/modules/xcm-bridge-hub-router/src/lib.rs index a9177412a2d..82c9c210719 100644 --- a/modules/xcm-bridge-hub-router/src/lib.rs +++ b/modules/xcm-bridge-hub-router/src/lib.rs @@ -73,7 +73,7 @@ pub mod pallet { /// The bridged network that this config is for. type BridgedNetworkId: Get; - /// Actual message sender (XCMP/DMP) to the sibling bridge hub location. + /// Actual message sender (`HRMP` or `DMP`) to the sibling bridge hub location. type ToBridgeHubSender: SendXcm; /// Underlying channel with the sibling bridge hub. It must match the channel, used /// by the `Self::ToBridgeHubSender`. @@ -343,10 +343,7 @@ mod tests { .into_inner() / FixedU128::DIV + HRMP_FEE; assert_eq!( - XcmBridgeHubRouter::validate(&mut Some(dest), &mut Some(xcm.clone())) - .unwrap() - .1 - .get(0), + XcmBridgeHubRouter::validate(&mut Some(dest), &mut Some(xcm)).unwrap().1.get(0), Some(&(BridgeFeeAsset::get(), expected_fee).into()), ); }); diff --git a/modules/xcm-bridge-hub-router/src/mock.rs b/modules/xcm-bridge-hub-router/src/mock.rs index 320278609fa..b585ee76ba5 100644 --- a/modules/xcm-bridge-hub-router/src/mock.rs +++ b/modules/xcm-bridge-hub-router/src/mock.rs @@ -114,7 +114,7 @@ impl SendXcm for TestToBridgeHubSender { fn deliver(_ticket: Self::Ticket) -> Result { frame_support::storage::unhashed::put(b"TestToBridgeHubSender.Sent", &true); - Ok([0u8; 32].into()) + Ok([0u8; 32]) } } diff --git a/primitives/messages/src/target_chain.rs b/primitives/messages/src/target_chain.rs index 0c824664a04..60f5c1b3c1c 100644 --- a/primitives/messages/src/target_chain.rs +++ b/primitives/messages/src/target_chain.rs @@ -96,7 +96,7 @@ pub trait MessageDispatch { /// simply drop messages if it returns `false`. The consumer may still call the `dispatch` /// if dispatcher has returned `false`. /// - /// We check it in the messages delivery transaction prolgoue. So if it becomes `false` + /// We check it in the messages delivery transaction prologue. So if it becomes `false` /// after some portion of messages is already dispatched, it doesn't fail the whole transaction. fn is_active() -> bool;