mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-30 22:11:02 +00:00
Fix updated clippy grumbles (#733)
* Revert "Pin Rust Nightly to 2020-12-17 (#652)" This reverts commit e54e6f7e3d34c28d698e637f9099162b3c1917e9. * fix clippy * clippy again * more clippy in test code * and new cargo fmt * another try
This commit is contained in:
committed by
Bastian Köcher
parent
85bb45b5d3
commit
90113303f1
@@ -23,6 +23,8 @@
|
|||||||
#![allow(clippy::large_enum_variant)]
|
#![allow(clippy::large_enum_variant)]
|
||||||
// Runtime-generated DecodeLimit::decode_all_With_depth_limit
|
// Runtime-generated DecodeLimit::decode_all_With_depth_limit
|
||||||
#![allow(clippy::unnecessary_mut_passed)]
|
#![allow(clippy::unnecessary_mut_passed)]
|
||||||
|
// From construct_runtime macro
|
||||||
|
#![allow(clippy::from_over_into)]
|
||||||
|
|
||||||
// Make the WASM binary available.
|
// Make the WASM binary available.
|
||||||
#[cfg(feature = "std")]
|
#[cfg(feature = "std")]
|
||||||
|
|||||||
@@ -23,6 +23,8 @@
|
|||||||
#![allow(clippy::large_enum_variant)]
|
#![allow(clippy::large_enum_variant)]
|
||||||
// Runtime-generated DecodeLimit::decode_all_With_depth_limit
|
// Runtime-generated DecodeLimit::decode_all_With_depth_limit
|
||||||
#![allow(clippy::unnecessary_mut_passed)]
|
#![allow(clippy::unnecessary_mut_passed)]
|
||||||
|
// From construct_runtime macro
|
||||||
|
#![allow(clippy::from_over_into)]
|
||||||
|
|
||||||
// Make the WASM binary available.
|
// Make the WASM binary available.
|
||||||
#[cfg(feature = "std")]
|
#[cfg(feature = "std")]
|
||||||
|
|||||||
@@ -394,6 +394,9 @@ where
|
|||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
|
// From construct_runtime macro
|
||||||
|
#![allow(clippy::from_over_into)]
|
||||||
|
|
||||||
use super::*;
|
use super::*;
|
||||||
use frame_support::{parameter_types, weights::Weight};
|
use frame_support::{parameter_types, weights::Weight};
|
||||||
use frame_system::{EventRecord, Phase};
|
use frame_system::{EventRecord, Phase};
|
||||||
|
|||||||
@@ -210,6 +210,9 @@ fn prepare_deposit_details<T: Config<I>, I: Instance>(
|
|||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
|
// From construct_runtime macro
|
||||||
|
#![allow(clippy::from_over_into)]
|
||||||
|
|
||||||
use super::*;
|
use super::*;
|
||||||
use bp_currency_exchange::LockFundsTransaction;
|
use bp_currency_exchange::LockFundsTransaction;
|
||||||
use frame_support::{assert_noop, assert_ok, construct_runtime, parameter_types, weights::Weight};
|
use frame_support::{assert_noop, assert_ok, construct_runtime, parameter_types, weights::Weight};
|
||||||
|
|||||||
@@ -85,7 +85,7 @@ pub fn from_substrate_block_number(number: BlockNumber) -> Result<U256, Error> {
|
|||||||
|
|
||||||
/// Parse Substrate header.
|
/// Parse Substrate header.
|
||||||
pub fn parse_substrate_header(raw_header: &[u8]) -> Result<Header, Error> {
|
pub fn parse_substrate_header(raw_header: &[u8]) -> Result<Header, Error> {
|
||||||
let substrate_header = RuntimeHeader::decode(&mut &raw_header[..])
|
let substrate_header = RuntimeHeader::decode(&mut &*raw_header)
|
||||||
.map(|header| Header {
|
.map(|header| Header {
|
||||||
hash: header.hash(),
|
hash: header.hash(),
|
||||||
parent_hash: header.parent_hash,
|
parent_hash: header.parent_hash,
|
||||||
@@ -100,7 +100,7 @@ pub fn parse_substrate_header(raw_header: &[u8]) -> Result<Header, Error> {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
.and_then(|log| ConsensusLog::decode(&mut &log[..]).ok())
|
.and_then(|log| ConsensusLog::decode(&mut &*log).ok())
|
||||||
.and_then(|log| match log {
|
.and_then(|log| match log {
|
||||||
ConsensusLog::ScheduledChange(scheduled_change) => Some(ValidatorsSetSignal {
|
ConsensusLog::ScheduledChange(scheduled_change) => Some(ValidatorsSetSignal {
|
||||||
delay: scheduled_change.delay,
|
delay: scheduled_change.delay,
|
||||||
@@ -133,7 +133,7 @@ pub fn verify_substrate_finality_proof(
|
|||||||
raw_best_set: &[u8],
|
raw_best_set: &[u8],
|
||||||
raw_finality_proof: &[u8],
|
raw_finality_proof: &[u8],
|
||||||
) -> Result<(), Error> {
|
) -> Result<(), Error> {
|
||||||
let best_set = AuthorityList::decode(&mut &raw_best_set[..])
|
let best_set = AuthorityList::decode(&mut &*raw_best_set)
|
||||||
.map_err(Error::BestSetDecode)
|
.map_err(Error::BestSetDecode)
|
||||||
.and_then(|authorities| VoterSet::new(authorities.into_iter()).ok_or(Error::InvalidBestSet));
|
.and_then(|authorities| VoterSet::new(authorities.into_iter()).ok_or(Error::InvalidBestSet));
|
||||||
|
|
||||||
|
|||||||
@@ -14,6 +14,9 @@
|
|||||||
// You should have received a copy of the GNU General Public License
|
// You should have received a copy of the GNU General Public License
|
||||||
// along with Parity Bridges Common. If not, see <http://www.gnu.org/licenses/>.
|
// along with Parity Bridges Common. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
// From construct_runtime macro
|
||||||
|
#![allow(clippy::from_over_into)]
|
||||||
|
|
||||||
pub use crate::test_utils::{insert_header, validator_utils::*, validators_change_receipt, HeaderBuilder, GAS_LIMIT};
|
pub use crate::test_utils::{insert_header, validator_utils::*, validators_change_receipt, HeaderBuilder, GAS_LIMIT};
|
||||||
pub use bp_eth_poa::signatures::secret_to_address;
|
pub use bp_eth_poa::signatures::secret_to_address;
|
||||||
|
|
||||||
|
|||||||
@@ -14,6 +14,9 @@
|
|||||||
// You should have received a copy of the GNU General Public License
|
// You should have received a copy of the GNU General Public License
|
||||||
// along with Parity Bridges Common. If not, see <http://www.gnu.org/licenses/>.
|
// along with Parity Bridges Common. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
// From construct_runtime macro
|
||||||
|
#![allow(clippy::from_over_into)]
|
||||||
|
|
||||||
use crate::pallet::{BridgedHeader, Config};
|
use crate::pallet::{BridgedHeader, Config};
|
||||||
use bp_runtime::{BlockNumberOf, Chain};
|
use bp_runtime::{BlockNumberOf, Chain};
|
||||||
use frame_support::{construct_runtime, parameter_types, weights::Weight};
|
use frame_support::{construct_runtime, parameter_types, weights::Weight};
|
||||||
|
|||||||
@@ -14,6 +14,9 @@
|
|||||||
// You should have received a copy of the GNU General Public License
|
// You should have received a copy of the GNU General Public License
|
||||||
// along with Parity Bridges Common. If not, see <http://www.gnu.org/licenses/>.
|
// along with Parity Bridges Common. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
// From construct_runtime macro
|
||||||
|
#![allow(clippy::from_over_into)]
|
||||||
|
|
||||||
use crate::Config;
|
use crate::Config;
|
||||||
|
|
||||||
use bp_message_lane::{
|
use bp_message_lane::{
|
||||||
|
|||||||
@@ -86,6 +86,9 @@ impl<T: Config> Module<T> {
|
|||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
|
// From construct_runtime macro
|
||||||
|
#![allow(clippy::from_over_into)]
|
||||||
|
|
||||||
use super::*;
|
use super::*;
|
||||||
use frame_support::sp_io::TestExternalities;
|
use frame_support::sp_io::TestExternalities;
|
||||||
use frame_support::sp_runtime::{
|
use frame_support::sp_runtime::{
|
||||||
|
|||||||
@@ -19,6 +19,8 @@
|
|||||||
//! Includes some useful testing types and functions.
|
//! Includes some useful testing types and functions.
|
||||||
|
|
||||||
#![cfg(test)]
|
#![cfg(test)]
|
||||||
|
// From construct_runtime macro
|
||||||
|
#![allow(clippy::from_over_into)]
|
||||||
|
|
||||||
use crate::{BridgedBlockHash, BridgedBlockNumber, BridgedHeader, Config};
|
use crate::{BridgedBlockHash, BridgedBlockNumber, BridgedHeader, Config};
|
||||||
use bp_runtime::Chain;
|
use bp_runtime::Chain;
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ pub enum Error {
|
|||||||
pub fn decode_justification_target<Header: HeaderT>(
|
pub fn decode_justification_target<Header: HeaderT>(
|
||||||
raw_justification: &[u8],
|
raw_justification: &[u8],
|
||||||
) -> Result<(Header::Hash, Header::Number), Error> {
|
) -> Result<(Header::Hash, Header::Number), Error> {
|
||||||
GrandpaJustification::<Header>::decode(&mut &raw_justification[..])
|
GrandpaJustification::<Header>::decode(&mut &*raw_justification)
|
||||||
.map(|justification| (justification.commit.target_hash, justification.commit.target_number))
|
.map(|justification| (justification.commit.target_hash, justification.commit.target_number))
|
||||||
.map_err(|_| Error::JustificationDecode)
|
.map_err(|_| Error::JustificationDecode)
|
||||||
}
|
}
|
||||||
@@ -65,7 +65,7 @@ where
|
|||||||
{
|
{
|
||||||
// Decode justification first
|
// Decode justification first
|
||||||
let justification =
|
let justification =
|
||||||
GrandpaJustification::<Header>::decode(&mut &raw_justification[..]).map_err(|_| Error::JustificationDecode)?;
|
GrandpaJustification::<Header>::decode(&mut &*raw_justification).map_err(|_| Error::JustificationDecode)?;
|
||||||
|
|
||||||
// Ensure that it is justification for the expected header
|
// Ensure that it is justification for the expected header
|
||||||
if (justification.commit.target_hash, justification.commit.target_number) != finalized_target {
|
if (justification.commit.target_hash, justification.commit.target_number) != finalized_target {
|
||||||
|
|||||||
@@ -57,8 +57,7 @@ impl MaybeConnectionError for Error {
|
|||||||
fn is_connection_error(&self) -> bool {
|
fn is_connection_error(&self) -> bool {
|
||||||
matches!(
|
matches!(
|
||||||
*self,
|
*self,
|
||||||
Error::Request(RequestError::TransportError(_))
|
Error::Request(RequestError::TransportError(_)) | Error::ClientNotSynced(_),
|
||||||
| Error::ClientNotSynced(_),
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -63,7 +63,6 @@ fn main() {
|
|||||||
.is_err()
|
.is_err()
|
||||||
{
|
{
|
||||||
log::error!(target: "bridge", "Unable to get Substrate genesis block for Ethereum sync.");
|
log::error!(target: "bridge", "Unable to get Substrate genesis block for Ethereum sync.");
|
||||||
return;
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
("sub-to-eth", Some(sub_to_eth_matches)) => {
|
("sub-to-eth", Some(sub_to_eth_matches)) => {
|
||||||
@@ -78,7 +77,6 @@ fn main() {
|
|||||||
.is_err()
|
.is_err()
|
||||||
{
|
{
|
||||||
log::error!(target: "bridge", "Unable to get Substrate genesis block for Substrate sync.");
|
log::error!(target: "bridge", "Unable to get Substrate genesis block for Substrate sync.");
|
||||||
return;
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
("eth-deploy-contract", Some(eth_deploy_matches)) => {
|
("eth-deploy-contract", Some(eth_deploy_matches)) => {
|
||||||
|
|||||||
@@ -61,8 +61,7 @@ impl MaybeConnectionError for Error {
|
|||||||
fn is_connection_error(&self) -> bool {
|
fn is_connection_error(&self) -> bool {
|
||||||
matches!(
|
matches!(
|
||||||
*self,
|
*self,
|
||||||
Error::Request(RequestError::TransportError(_))
|
Error::Request(RequestError::TransportError(_)) | Error::ClientNotSynced(_)
|
||||||
| Error::ClientNotSynced(_)
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user