Skip to content

Commit

Permalink
Update clippy now that redundant imports has been reverted
Browse files Browse the repository at this point in the history
  • Loading branch information
kayabaNerve committed Apr 23, 2024
1 parent a25e633 commit a41329c
Show file tree
Hide file tree
Showing 20 changed files with 46 additions and 46 deletions.
2 changes: 1 addition & 1 deletion .github/nightly-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
nightly-2024-02-07
nightly-2024-04-23
15 changes: 7 additions & 8 deletions coins/monero/src/wallet/address.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
use core::{marker::PhantomData, fmt::Debug};
use std_shims::string::{String, ToString};
use core::{marker::PhantomData, fmt};

use zeroize::Zeroize;

Expand Down Expand Up @@ -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);
}

Expand Down Expand Up @@ -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)
Expand All @@ -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());
Expand All @@ -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())
}
}

Expand Down
2 changes: 1 addition & 1 deletion common/db/src/parity_db.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions coordinator/tributary/src/provided.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion crypto/dalek-ff-group/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ repository = "https://github.com/serai-dex/serai/tree/develop/crypto/dalek-ff-gr
authors = ["Luke Parker <[email protected]>"]
keywords = ["curve25519", "ed25519", "ristretto", "dalek", "group"]
edition = "2021"
rust-version = "1.65"
rust-version = "1.66"

[package.metadata.docs.rs]
all-features = true
Expand Down
2 changes: 1 addition & 1 deletion crypto/dkg/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ repository = "https://github.com/serai-dex/serai/tree/develop/crypto/dkg"
authors = ["Luke Parker <[email protected]>"]
keywords = ["dkg", "multisig", "threshold", "ff", "group"]
edition = "2021"
rust-version = "1.70"
rust-version = "1.74"

[package.metadata.docs.rs]
all-features = true
Expand Down
2 changes: 1 addition & 1 deletion crypto/dleq/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ license = "MIT"
repository = "https://github.com/serai-dex/serai/tree/develop/crypto/dleq"
authors = ["Luke Parker <[email protected]>"]
edition = "2021"
rust-version = "1.73"
rust-version = "1.74"

[package.metadata.docs.rs]
all-features = true
Expand Down
2 changes: 1 addition & 1 deletion crypto/ed448/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ repository = "https://github.com/serai-dex/serai/tree/develop/crypto/ed448"
authors = ["Luke Parker <[email protected]>"]
keywords = ["ed448", "ff", "group"]
edition = "2021"
rust-version = "1.65"
rust-version = "1.66"

[package.metadata.docs.rs]
all-features = true
Expand Down
6 changes: 3 additions & 3 deletions processor/src/networks/bitcoin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
Expand Down Expand Up @@ -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);
}
}

Expand Down
23 changes: 12 additions & 11 deletions processor/src/networks/ethereum.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use core::{fmt::Debug, time::Duration};
use core::{fmt, time::Duration};
use std::{
sync::Arc,
collections::{HashSet, HashMap},
Expand Down Expand Up @@ -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)
}
}

Expand All @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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 {
Expand Down Expand Up @@ -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.
Expand All @@ -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),
Expand Down Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion substrate/abi/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ license = "MIT"
repository = "https://github.com/serai-dex/serai/tree/develop/substrate/abi"
authors = ["Luke Parker <[email protected]>"]
edition = "2021"
rust-version = "1.69"
rust-version = "1.74"

[package.metadata.docs.rs]
all-features = true
Expand Down
8 changes: 4 additions & 4 deletions substrate/client/src/networks/bitcoin.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use core::str::FromStr;
use core::{str::FromStr, fmt};

use scale::{Encode, Decode};

Expand Down Expand Up @@ -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)
}
}

Expand Down
8 changes: 4 additions & 4 deletions substrate/client/src/networks/monero.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use core::str::FromStr;
use core::{str::FromStr, fmt};

use scale::{Encode, Decode};

Expand All @@ -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)
}
}

Expand Down
2 changes: 1 addition & 1 deletion substrate/coins/pallet/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ license = "AGPL-3.0-only"
repository = "https://github.com/serai-dex/serai/tree/develop/substrate/coins/pallet"
authors = ["Akil Demir <[email protected]>"]
edition = "2021"
rust-version = "1.70"
rust-version = "1.74"

[package.metadata.docs.rs]
all-features = true
Expand Down
2 changes: 1 addition & 1 deletion substrate/coins/primitives/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ description = "Serai coins primitives"
license = "MIT"
authors = ["Luke Parker <[email protected]>"]
edition = "2021"
rust-version = "1.69"
rust-version = "1.74"

[package.metadata.docs.rs]
all-features = true
Expand Down
2 changes: 1 addition & 1 deletion substrate/dex/pallet/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ license = "AGPL-3.0-only"
repository = "https://github.com/serai-dex/serai/tree/develop/substrate/dex/pallet"
authors = ["Parity Technologies <[email protected]>, Akil Demir <[email protected]>"]
edition = "2021"
rust-version = "1.70"
rust-version = "1.74"

[package.metadata.docs.rs]
all-features = true
Expand Down
2 changes: 1 addition & 1 deletion substrate/dex/pallet/src/benchmarking.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion substrate/in-instructions/pallet/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion substrate/in-instructions/primitives/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ description = "Serai instructions library, enabling encoding and decoding"
license = "MIT"
authors = ["Luke Parker <[email protected]>"]
edition = "2021"
rust-version = "1.69"
rust-version = "1.74"

[package.metadata.docs.rs]
all-features = true
Expand Down
2 changes: 1 addition & 1 deletion substrate/primitives/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ license = "MIT"
repository = "https://github.com/serai-dex/serai/tree/develop/substrate/primitives"
authors = ["Luke Parker <[email protected]>"]
edition = "2021"
rust-version = "1.69"
rust-version = "1.74"

[package.metadata.docs.rs]
all-features = true
Expand Down

0 comments on commit a41329c

Please sign in to comment.