Skip to content

Commit 9a9defc

Browse files
committed
clippy issues
1 parent 81fc858 commit 9a9defc

File tree

78 files changed

+165
-146
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

78 files changed

+165
-146
lines changed

src/catalyst-toolbox/catalyst-toolbox/src/bin/cli/kedqr/decode/img.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ use std::path::Path;
1111
use std::path::PathBuf;
1212

1313
pub fn save_secret_from_qr(qr: PathBuf, output: Option<PathBuf>, pin: QrPin) -> Result<(), Report> {
14-
let sk = secret_from_qr(&qr, pin)?;
14+
let sk = secret_from_qr(qr, pin)?;
1515
let hrp = Ed25519Extended::SECRET_BECH32_HRP;
1616
let secret_key = bech32::encode(hrp, sk.leak_secret().to_base32(), Variant::Bech32)?;
1717

src/catalyst-toolbox/catalyst-toolbox/src/bin/cli/kedqr/encode/img.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ pub fn generate_qr(input: PathBuf, output: Option<PathBuf>, pin: QrPin) -> Resul
1515
.read(true)
1616
.write(false)
1717
.append(false)
18-
.open(&input)
18+
.open(input)
1919
.expect("Could not open input file.");
2020

2121
let mut reader = BufReader::new(key_file);

src/catalyst-toolbox/catalyst-toolbox/src/bin/cli/kedqr/encode/payload.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ pub fn generate_payload(input: PathBuf, output: Option<PathBuf>, pin: QrPin) ->
1818
.read(true)
1919
.write(false)
2020
.append(false)
21-
.open(&input)
21+
.open(input)
2222
.expect("Could not open input file.");
2323

2424
let mut reader = BufReader::new(key_file);

src/catalyst-toolbox/catalyst-toolbox/src/bin/cli/stats/snapshot.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ pub enum Command {
2525

2626
impl SnapshotCommand {
2727
pub fn exec(&self) -> Result<(), Report> {
28-
let initials: Vec<Initial> = read_initials(&jortestkit::file::read_file(&self.snapshot)?)?;
28+
let initials: Vec<Initial> = read_initials(jortestkit::file::read_file(&self.snapshot)?)?;
2929

3030
match self.command {
3131
Command::Count => calculate_wallet_distribution_from_initials(

src/catalyst-toolbox/snapshot-lib/src/registration.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ mod serde_impl {
173173
use bech32::ToBase32;
174174
let bytes = hex::decode(String::deserialize(deserializer)?.trim_start_matches("0x"))
175175
.map_err(|e| D::Error::custom(format!("invalid hex string: {}", e)))?;
176-
bech32::encode("stake", &bytes.to_base32(), bech32::Variant::Bech32)
176+
bech32::encode("stake", bytes.to_base32(), bech32::Variant::Bech32)
177177
.map_err(|e| D::Error::custom(format!("bech32 encoding failed: {}", e)))
178178
}
179179
}
@@ -237,7 +237,7 @@ mod tests {
237237
.prop_map(|((stake_key, rewards_addr, delegations), vp)| {
238238
let stake_public_key = hex::encode(stake_key);
239239
let reward_address =
240-
bech32::encode("stake", &rewards_addr.to_base32(), bech32::Variant::Bech32)
240+
bech32::encode("stake", rewards_addr.to_base32(), bech32::Variant::Bech32)
241241
.unwrap();
242242
let voting_power: Value = vp.into();
243243
VotingRegistration {

src/chain-libs/chain-impl-mockchain/src/accounting/account/last_rewards.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,18 +15,20 @@ pub struct LastRewards {
1515
pub reward: Value,
1616
}
1717

18-
impl LastRewards {
18+
impl Default for LastRewards {
1919
/// Create an initial value of epoch=0 reward=0
2020
///
2121
/// It is also safe as the "uninitialized" value, since
2222
/// epoch 0 doesn't have by construction any reward associated.
23-
pub fn default() -> Self {
23+
fn default() -> Self {
2424
LastRewards {
2525
epoch: 0,
2626
reward: Value::zero(),
2727
}
2828
}
29+
}
2930

31+
impl LastRewards {
3032
/// Add some value to the last reward, if the epoch is the same, then the
3133
/// result is just added, however.account
3234
///

src/chain-libs/chain-impl-mockchain/src/certificate/pool.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -764,7 +764,7 @@ mod tests {
764764
let mut sigs = Vec::new();
765765
for (i, key) in pool_owner_with_sign.indexed_signatories_sks() {
766766
let sig = SingleAccountBindingSignature::new(&auth_data, |d| key.sign_slice(d.0));
767-
sigs.push((i as u8, sig))
767+
sigs.push((i, sig))
768768
}
769769
let pool_owner_signed = PoolOwnersSigned { signatures: sigs };
770770
let verification = if should_pass {

src/chain-libs/chain-impl-mockchain/src/header/test.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,8 @@ impl Arbitrary for GenesisPraosProof {
6363
let node_id = Arbitrary::arbitrary(g);
6464

6565
let vrf_proof = {
66-
let sk = RistrettoGroup2HashDh::generate(&mut tcg.get_rng(0));
67-
RistrettoGroup2HashDh::evaluate_and_prove(&sk, &[0, 1, 2, 3], &mut tcg.get_rng(1))
66+
let sk = RistrettoGroup2HashDh::generate(tcg.get_rng(0));
67+
RistrettoGroup2HashDh::evaluate_and_prove(&sk, &[0, 1, 2, 3], tcg.get_rng(1))
6868
};
6969

7070
let kes_proof = {

src/chain-libs/chain-impl-mockchain/src/key.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -428,8 +428,8 @@ mod tests {
428428
}
429429

430430
let tcg = testing::TestCryptoGen::arbitrary(g);
431-
let mut rng = tcg.get_rng(0);
432-
let vrf_sk: SecretKey<RistrettoGroup2HashDh> = SecretKey::generate(&mut rng);
431+
let rng = tcg.get_rng(0);
432+
let vrf_sk: SecretKey<RistrettoGroup2HashDh> = SecretKey::generate(rng);
433433
GenesisPraosLeader {
434434
vrf_public_key: vrf_sk.to_public(),
435435
kes_public_key: PK_KES.clone(),

src/chain-libs/chain-impl-mockchain/src/leadership/bft.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ impl LeadershipData {
3636
#[inline]
3737
fn offset(&self, block_number: u64) -> BftRoundRobinIndex {
3838
let max = self.number_of_leaders() as u64;
39-
BftRoundRobinIndex((block_number % max) as u64)
39+
BftRoundRobinIndex(block_number % max)
4040
}
4141

4242
pub(crate) fn verify(&self, block_header: &Header) -> Verification {

0 commit comments

Comments
 (0)