mirror of
https://github.com/serai-dex/serai.git
synced 2025-01-03 09:29:46 +00:00
Update clippy now that redundant imports has been reverted
This commit is contained in:
parent
a25e6330bd
commit
a41329c027
20 changed files with 46 additions and 46 deletions
2
.github/nightly-version
vendored
2
.github/nightly-version
vendored
|
@ -1 +1 @@
|
|||
nightly-2024-02-07
|
||||
nightly-2024-04-23
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
use core::{marker::PhantomData, fmt::Debug};
|
||||
use std_shims::string::{String, ToString};
|
||||
use core::{marker::PhantomData, fmt};
|
||||
|
||||
use zeroize::Zeroize;
|
||||
|
||||
|
@ -81,7 +80,7 @@ impl AddressType {
|
|||
}
|
||||
|
||||
/// A type which returns the byte for a given address.
|
||||
pub trait AddressBytes: Clone + Copy + PartialEq + Eq + Debug {
|
||||
pub trait AddressBytes: Clone + Copy + PartialEq + Eq + fmt::Debug {
|
||||
fn network_bytes(network: Network) -> (u8, u8, u8, u8);
|
||||
}
|
||||
|
||||
|
@ -191,8 +190,8 @@ pub struct Address<B: AddressBytes> {
|
|||
pub view: EdwardsPoint,
|
||||
}
|
||||
|
||||
impl<B: AddressBytes> core::fmt::Debug for Address<B> {
|
||||
fn fmt(&self, fmt: &mut core::fmt::Formatter<'_>) -> Result<(), core::fmt::Error> {
|
||||
impl<B: AddressBytes> fmt::Debug for Address<B> {
|
||||
fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> Result<(), fmt::Error> {
|
||||
fmt
|
||||
.debug_struct("Address")
|
||||
.field("meta", &self.meta)
|
||||
|
@ -212,8 +211,8 @@ impl<B: AddressBytes> Zeroize for Address<B> {
|
|||
}
|
||||
}
|
||||
|
||||
impl<B: AddressBytes> ToString for Address<B> {
|
||||
fn to_string(&self) -> String {
|
||||
impl<B: AddressBytes> fmt::Display for Address<B> {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
let mut data = vec![self.meta.to_byte()];
|
||||
data.extend(self.spend.compress().to_bytes());
|
||||
data.extend(self.view.compress().to_bytes());
|
||||
|
@ -226,7 +225,7 @@ impl<B: AddressBytes> ToString for Address<B> {
|
|||
if let Some(id) = self.meta.kind.payment_id() {
|
||||
data.extend(id);
|
||||
}
|
||||
encode_check(&data).unwrap()
|
||||
write!(f, "{}", encode_check(&data).unwrap())
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@ impl Get for Transaction<'_> {
|
|||
let mut res = self.0.get(&key);
|
||||
for change in &self.1 {
|
||||
if change.1 == key.as_ref() {
|
||||
res = change.2.clone();
|
||||
res.clone_from(&change.2);
|
||||
}
|
||||
}
|
||||
res
|
||||
|
|
|
@ -74,7 +74,7 @@ impl<D: Db, T: Transaction> ProvidedTransactions<D, T> {
|
|||
panic!("provided transaction saved to disk wasn't provided");
|
||||
};
|
||||
|
||||
if res.transactions.get(order).is_none() {
|
||||
if !res.transactions.contains_key(order) {
|
||||
res.transactions.insert(order, VecDeque::new());
|
||||
}
|
||||
res.transactions.get_mut(order).unwrap().push_back(tx);
|
||||
|
@ -135,7 +135,7 @@ impl<D: Db, T: Transaction> ProvidedTransactions<D, T> {
|
|||
txn.put(current_provided_key, currently_provided);
|
||||
txn.commit();
|
||||
|
||||
if self.transactions.get(order).is_none() {
|
||||
if !self.transactions.contains_key(order) {
|
||||
self.transactions.insert(order, VecDeque::new());
|
||||
}
|
||||
self.transactions.get_mut(order).unwrap().push_back(tx);
|
||||
|
|
|
@ -7,7 +7,7 @@ repository = "https://github.com/serai-dex/serai/tree/develop/crypto/dalek-ff-gr
|
|||
authors = ["Luke Parker <lukeparker5132@gmail.com>"]
|
||||
keywords = ["curve25519", "ed25519", "ristretto", "dalek", "group"]
|
||||
edition = "2021"
|
||||
rust-version = "1.65"
|
||||
rust-version = "1.66"
|
||||
|
||||
[package.metadata.docs.rs]
|
||||
all-features = true
|
||||
|
|
|
@ -7,7 +7,7 @@ repository = "https://github.com/serai-dex/serai/tree/develop/crypto/dkg"
|
|||
authors = ["Luke Parker <lukeparker5132@gmail.com>"]
|
||||
keywords = ["dkg", "multisig", "threshold", "ff", "group"]
|
||||
edition = "2021"
|
||||
rust-version = "1.70"
|
||||
rust-version = "1.74"
|
||||
|
||||
[package.metadata.docs.rs]
|
||||
all-features = true
|
||||
|
|
|
@ -6,7 +6,7 @@ license = "MIT"
|
|||
repository = "https://github.com/serai-dex/serai/tree/develop/crypto/dleq"
|
||||
authors = ["Luke Parker <lukeparker5132@gmail.com>"]
|
||||
edition = "2021"
|
||||
rust-version = "1.73"
|
||||
rust-version = "1.74"
|
||||
|
||||
[package.metadata.docs.rs]
|
||||
all-features = true
|
||||
|
|
|
@ -7,7 +7,7 @@ repository = "https://github.com/serai-dex/serai/tree/develop/crypto/ed448"
|
|||
authors = ["Luke Parker <lukeparker5132@gmail.com>"]
|
||||
keywords = ["ed448", "ff", "group"]
|
||||
edition = "2021"
|
||||
rust-version = "1.65"
|
||||
rust-version = "1.66"
|
||||
|
||||
[package.metadata.docs.rs]
|
||||
all-features = true
|
||||
|
|
|
@ -517,7 +517,7 @@ impl Bitcoin {
|
|||
if witness.len() >= 2 {
|
||||
let redeem_script = ScriptBuf::from_bytes(witness.last().unwrap().clone());
|
||||
if Self::segwit_data_pattern(&redeem_script) == Some(true) {
|
||||
data = witness[witness.len() - 2].clone(); // len() - 1 is the redeem_script
|
||||
data.clone_from(&witness[witness.len() - 2]); // len() - 1 is the redeem_script
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -731,9 +731,9 @@ impl Network for Bitcoin {
|
|||
let data = Self::extract_serai_data(tx);
|
||||
for output in &mut outputs {
|
||||
if output.kind == OutputType::External {
|
||||
output.data = data.clone();
|
||||
output.data.clone_from(&data);
|
||||
}
|
||||
output.presumed_origin = presumed_origin.clone();
|
||||
output.presumed_origin.clone_from(&presumed_origin);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
use core::{fmt::Debug, time::Duration};
|
||||
use core::{fmt, time::Duration};
|
||||
use std::{
|
||||
sync::Arc,
|
||||
collections::{HashSet, HashMap},
|
||||
|
@ -108,9 +108,10 @@ impl TryInto<Vec<u8>> for Address {
|
|||
Ok(self.0.to_vec())
|
||||
}
|
||||
}
|
||||
impl ToString for Address {
|
||||
fn to_string(&self) -> String {
|
||||
ethereum_serai::alloy_core::primitives::Address::from(self.0).to_string()
|
||||
|
||||
impl fmt::Display for Address {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
ethereum_serai::alloy_core::primitives::Address::from(self.0).fmt(f)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -122,7 +123,7 @@ impl SignableTransaction for RouterCommand {
|
|||
}
|
||||
|
||||
#[async_trait]
|
||||
impl<D: Debug + Db> TransactionTrait<Ethereum<D>> for Transaction {
|
||||
impl<D: fmt::Debug + Db> TransactionTrait<Ethereum<D>> for Transaction {
|
||||
type Id = [u8; 32];
|
||||
fn id(&self) -> Self::Id {
|
||||
self.hash.0
|
||||
|
@ -155,7 +156,7 @@ impl Epoch {
|
|||
}
|
||||
|
||||
#[async_trait]
|
||||
impl<D: Debug + Db> Block<Ethereum<D>> for Epoch {
|
||||
impl<D: fmt::Debug + Db> Block<Ethereum<D>> for Epoch {
|
||||
type Id = [u8; 32];
|
||||
fn id(&self) -> [u8; 32] {
|
||||
self.end_hash
|
||||
|
@ -168,7 +169,7 @@ impl<D: Debug + Db> Block<Ethereum<D>> for Epoch {
|
|||
}
|
||||
}
|
||||
|
||||
impl<D: Debug + Db> Output<Ethereum<D>> for EthereumInInstruction {
|
||||
impl<D: fmt::Debug + Db> Output<Ethereum<D>> for EthereumInInstruction {
|
||||
type Id = [u8; 32];
|
||||
|
||||
fn kind(&self) -> OutputType {
|
||||
|
@ -281,7 +282,7 @@ impl EventualityTrait for Eventuality {
|
|||
}
|
||||
|
||||
#[derive(Clone, Debug)]
|
||||
pub struct Ethereum<D: Debug + Db> {
|
||||
pub struct Ethereum<D: fmt::Debug + Db> {
|
||||
// This DB is solely used to access the first key generated, as needed to determine the Router's
|
||||
// address. Accordingly, all methods present are consistent to a Serai chain with a finalized
|
||||
// first key (regardless of local state), and this is safe.
|
||||
|
@ -290,12 +291,12 @@ pub struct Ethereum<D: Debug + Db> {
|
|||
deployer: Deployer,
|
||||
router: Arc<RwLock<Option<Router>>>,
|
||||
}
|
||||
impl<D: Debug + Db> PartialEq for Ethereum<D> {
|
||||
impl<D: fmt::Debug + Db> PartialEq for Ethereum<D> {
|
||||
fn eq(&self, _other: &Ethereum<D>) -> bool {
|
||||
true
|
||||
}
|
||||
}
|
||||
impl<D: Debug + Db> Ethereum<D> {
|
||||
impl<D: fmt::Debug + Db> Ethereum<D> {
|
||||
pub async fn new(db: D, url: String) -> Self {
|
||||
let provider = Arc::new(RootProvider::new(
|
||||
ClientBuilder::default().transport(SimpleRequest::new(url), true),
|
||||
|
@ -360,7 +361,7 @@ impl<D: Debug + Db> Ethereum<D> {
|
|||
}
|
||||
|
||||
#[async_trait]
|
||||
impl<D: Debug + Db> Network for Ethereum<D> {
|
||||
impl<D: fmt::Debug + Db> Network for Ethereum<D> {
|
||||
type Curve = Secp256k1;
|
||||
|
||||
type Transaction = Transaction;
|
||||
|
|
|
@ -6,7 +6,7 @@ license = "MIT"
|
|||
repository = "https://github.com/serai-dex/serai/tree/develop/substrate/abi"
|
||||
authors = ["Luke Parker <lukeparker5132@gmail.com>"]
|
||||
edition = "2021"
|
||||
rust-version = "1.69"
|
||||
rust-version = "1.74"
|
||||
|
||||
[package.metadata.docs.rs]
|
||||
all-features = true
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
use core::str::FromStr;
|
||||
use core::{str::FromStr, fmt};
|
||||
|
||||
use scale::{Encode, Decode};
|
||||
|
||||
|
@ -35,9 +35,9 @@ impl FromStr for Address {
|
|||
}
|
||||
}
|
||||
|
||||
impl ToString for Address {
|
||||
fn to_string(&self) -> String {
|
||||
self.0.to_string()
|
||||
impl fmt::Display for Address {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
self.0.fmt(f)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
use core::str::FromStr;
|
||||
use core::{str::FromStr, fmt};
|
||||
|
||||
use scale::{Encode, Decode};
|
||||
|
||||
|
@ -24,9 +24,9 @@ impl FromStr for Address {
|
|||
}
|
||||
}
|
||||
|
||||
impl ToString for Address {
|
||||
fn to_string(&self) -> String {
|
||||
self.0.to_string()
|
||||
impl fmt::Display for Address {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
self.0.fmt(f)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@ license = "AGPL-3.0-only"
|
|||
repository = "https://github.com/serai-dex/serai/tree/develop/substrate/coins/pallet"
|
||||
authors = ["Akil Demir <aeg_asd@hotmail.com>"]
|
||||
edition = "2021"
|
||||
rust-version = "1.70"
|
||||
rust-version = "1.74"
|
||||
|
||||
[package.metadata.docs.rs]
|
||||
all-features = true
|
||||
|
|
|
@ -5,7 +5,7 @@ description = "Serai coins primitives"
|
|||
license = "MIT"
|
||||
authors = ["Luke Parker <lukeparker5132@gmail.com>"]
|
||||
edition = "2021"
|
||||
rust-version = "1.69"
|
||||
rust-version = "1.74"
|
||||
|
||||
[package.metadata.docs.rs]
|
||||
all-features = true
|
||||
|
|
|
@ -6,7 +6,7 @@ license = "AGPL-3.0-only"
|
|||
repository = "https://github.com/serai-dex/serai/tree/develop/substrate/dex/pallet"
|
||||
authors = ["Parity Technologies <admin@parity.io>, Akil Demir <aeg_asd@hotmail.com>"]
|
||||
edition = "2021"
|
||||
rust-version = "1.70"
|
||||
rust-version = "1.74"
|
||||
|
||||
[package.metadata.docs.rs]
|
||||
all-features = true
|
||||
|
|
|
@ -43,7 +43,7 @@ fn create_coin<T: Config>(coin: &Coin) -> (T::AccountId, AccountIdLookupOf<T>) {
|
|||
let caller_lookup = T::Lookup::unlookup(caller);
|
||||
assert_ok!(Coins::<T>::mint(
|
||||
caller,
|
||||
Balance { coin: Coin::native(), amount: Amount(SubstrateAmount::max_value().div(1000u64)) }
|
||||
Balance { coin: Coin::native(), amount: Amount(SubstrateAmount::MAX.div(1000u64)) }
|
||||
));
|
||||
assert_ok!(Coins::<T>::mint(
|
||||
caller,
|
||||
|
|
|
@ -10,7 +10,7 @@ pub use in_instructions_primitives as primitives;
|
|||
use primitives::*;
|
||||
|
||||
// TODO: Investigate why Substrate generates these
|
||||
#[allow(clippy::cast_possible_truncation, clippy::no_effect_underscore_binding)]
|
||||
#[allow(clippy::cast_possible_truncation, clippy::no_effect_underscore_binding, clippy::empty_docs)]
|
||||
#[frame_support::pallet]
|
||||
pub mod pallet {
|
||||
use sp_std::vec;
|
||||
|
|
|
@ -5,7 +5,7 @@ description = "Serai instructions library, enabling encoding and decoding"
|
|||
license = "MIT"
|
||||
authors = ["Luke Parker <lukeparker5132@gmail.com>"]
|
||||
edition = "2021"
|
||||
rust-version = "1.69"
|
||||
rust-version = "1.74"
|
||||
|
||||
[package.metadata.docs.rs]
|
||||
all-features = true
|
||||
|
|
|
@ -6,7 +6,7 @@ license = "MIT"
|
|||
repository = "https://github.com/serai-dex/serai/tree/develop/substrate/primitives"
|
||||
authors = ["Luke Parker <lukeparker5132@gmail.com>"]
|
||||
edition = "2021"
|
||||
rust-version = "1.69"
|
||||
rust-version = "1.74"
|
||||
|
||||
[package.metadata.docs.rs]
|
||||
all-features = true
|
||||
|
|
Loading…
Reference in a new issue