Skip to content

Commit

Permalink
clippy: fix warnings in beta toolchain (nymtech#1639)
Browse files Browse the repository at this point in the history
  • Loading branch information
octol authored Sep 21, 2022
1 parent be20e17 commit e44ddc4
Show file tree
Hide file tree
Showing 17 changed files with 22 additions and 22 deletions.
2 changes: 1 addition & 1 deletion clients/client-core/src/client/cover_traffic_stream.rs
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ impl LoopCoverTrafficStream<OsRng> {
let cover_message = generate_loop_cover_packet(
&mut self.rng,
topology_ref,
&*self.ack_key,
&self.ack_key,
&self.our_full_destination,
self.average_ack_delay,
self.average_packet_delay,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ where
generate_loop_cover_packet(
&mut self.rng,
topology_ref,
&*self.ack_key,
&self.ack_key,
&self.our_full_destination,
self.config.average_ack_delay,
self.config.average_packet_delay,
Expand Down
4 changes: 2 additions & 2 deletions clients/native/src/commands/upgrade.rs
Original file line number Diff line number Diff line change
Expand Up @@ -103,15 +103,15 @@ fn minor_0_12_upgrade(
Version::new(0, 12, 0)
};

print_start_upgrade(&config_version, &to_version);
print_start_upgrade(config_version, &to_version);

config
.get_base_mut()
.set_custom_version(to_version.to_string().as_ref());

config.save_to_file(None).unwrap_or_else(|err| {
eprintln!("failed to overwrite config file! - {:?}", err);
print_failed_upgrade(&config_version, &to_version);
print_failed_upgrade(config_version, &to_version);
process::exit(1);
});

Expand Down
4 changes: 2 additions & 2 deletions clients/socks5/src/commands/upgrade.rs
Original file line number Diff line number Diff line change
Expand Up @@ -102,15 +102,15 @@ fn minor_0_12_upgrade(
Version::new(0, 12, 0)
};

print_start_upgrade(&config_version, &to_version);
print_start_upgrade(config_version, &to_version);

config
.get_base_mut()
.set_custom_version(to_version.to_string().as_ref());

config.save_to_file(None).unwrap_or_else(|err| {
eprintln!("failed to overwrite config file! - {:?}", err);
print_failed_upgrade(&config_version, &to_version);
print_failed_upgrade(config_version, &to_version);
process::exit(1);
});

Expand Down
2 changes: 1 addition & 1 deletion common/client-libs/mixnet-client/src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ impl Client {
address.into(),
receiver,
initial_connection_timeout,
&*current_reconnection_attempt,
&current_reconnection_attempt,
)
.await
});
Expand Down
2 changes: 1 addition & 1 deletion common/client-libs/validator-client/src/nymd/wallet/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ impl DirectSecp256k1HdWallet {
}

fn derive_keypair(&self, hd_path: &DerivationPath) -> Result<Secp256k1Keypair, NymdError> {
let extended_private_key = XPrv::derive_from_path(&self.seed, hd_path)?;
let extended_private_key = XPrv::derive_from_path(self.seed, hd_path)?;

let private_key: SigningKey = extended_private_key.into();
let public_key = private_key.public_key();
Expand Down
2 changes: 1 addition & 1 deletion common/commands/src/validator/account/balance.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ pub async fn query_balance(
return;
}

let denom = args.denom.unwrap_or_else(|| "".to_string());
let denom = args.denom.unwrap_or_default();

for coin in coins {
if denom.is_empty() || denom.eq_ignore_ascii_case(&coin.denom) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ pub async fn vesting_bond_gateway(client: SigningClient, args: Args, denom: &str
let coin = Coin::new(args.amount, denom);

let res = client
.vesting_bond_gateway(gateway, &*args.signature, coin.into(), None)
.vesting_bond_gateway(gateway, &args.signature, coin.into(), None)
.await
.expect("failed to bond gateway!");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ pub async fn vesting_bond_mixnode(client: SigningClient, args: Args, denom: &str
};

let res = client
.vesting_bond_mixnode(mixnode, cost_params, &*args.signature, coin.into(), None)
.vesting_bond_mixnode(mixnode, cost_params, &args.signature, coin.into(), None)
.await
.expect("failed to bond vesting mixnode!");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ pub async fn create(args: Args, client: SigningClient, network_details: &NymNetw

let res = client
.create_periodic_vesting_account(
&*args.address,
&args.address,
args.staking_address,
Some(vesting),
coin.into(),
Expand All @@ -70,7 +70,7 @@ pub async fn create(args: Args, client: SigningClient, network_details: &NymNetw

let send_coin_response = client
.send(
&AccountId::from_str(&*args.address).unwrap(),
&AccountId::from_str(&args.address).unwrap(),
vec![coin.into()],
"payment made :)",
None,
Expand Down
2 changes: 1 addition & 1 deletion common/credential-storage/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ async fn main() {
let out_dir = env::var("OUT_DIR").unwrap();
let database_path = format!("{}/coconut-credential-example.sqlite", out_dir);

let mut conn = SqliteConnection::connect(&*format!("sqlite://{}?mode=rwc", database_path))
let mut conn = SqliteConnection::connect(&format!("sqlite://{}?mode=rwc", database_path))
.await
.expect("Failed to create SQLx database connection");

Expand Down
2 changes: 1 addition & 1 deletion common/crypto/dkg/src/bte/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ impl Tau {

let tau_mem = self.0.as_raw_slice();
assert_eq!(tau_mem.len(), 1, "tau length invariant was broken");
random_oracle_builder.update(&tau_mem[0].to_be_bytes());
random_oracle_builder.update(tau_mem[0].to_be_bytes());

let oracle_output = random_oracle_builder.finalize();
debug_assert_eq!(oracle_output.len() * 8, HASH_SECURITY_PARAM);
Expand Down
2 changes: 1 addition & 1 deletion common/ledger/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ impl CosmosLedger {

/// Get the SECP265K1 address of the device.
pub fn get_addr_secp265k1(&self, display: bool) -> Result<AddrSecp265k1Response> {
let display = if display { 1 } else { 0 };
let display = u8::from(display);
let components = path_bytes(self.path.clone())?;
let data: Vec<u8> = vec![
[self.prefix.len() as u8].as_slice(),
Expand Down
4 changes: 2 additions & 2 deletions gateway/src/commands/upgrade.rs
Original file line number Diff line number Diff line change
Expand Up @@ -101,13 +101,13 @@ fn minor_0_12_upgrade(
Version::new(0, 12, 0)
};

print_start_upgrade(&config_version, &to_version);
print_start_upgrade(config_version, &to_version);

let upgraded_config = config.with_custom_version(to_version.to_string().as_ref());

upgraded_config.save_to_file(None).unwrap_or_else(|err| {
eprintln!("failed to overwrite config file! - {:?}", err);
print_failed_upgrade(&config_version, &to_version);
print_failed_upgrade(config_version, &to_version);
process::exit(1);
});

Expand Down
4 changes: 2 additions & 2 deletions mixnode/src/commands/upgrade.rs
Original file line number Diff line number Diff line change
Expand Up @@ -101,13 +101,13 @@ fn minor_0_12_upgrade(
Version::new(0, 12, 0)
};

print_start_upgrade(&config_version, &to_version);
print_start_upgrade(config_version, &to_version);

let upgraded_config = config.with_custom_version(to_version.to_string().as_ref());

upgraded_config.save_to_file(None).unwrap_or_else(|err| {
eprintln!("failed to overwrite config file! - {:?}", err);
print_failed_upgrade(&config_version, &to_version);
print_failed_upgrade(config_version, &to_version);
process::exit(1);
});

Expand Down
2 changes: 1 addition & 1 deletion nym-wallet/nym-wallet-recovery-cli/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ fn get_login_entry(login: &Value) -> Result<(&str, &str, &str)> {
}

fn base64_decode(ciphertext: &str, iv: &str, salt: &str) -> Result<(Vec<u8>, Vec<u8>, Vec<u8>)> {
let ciphertext = base64::decode(&ciphertext)
let ciphertext = base64::decode(ciphertext)
.map_err(|err| anyhow!("Unable to base64 decode ciphertext: {}", err))?;
let iv = base64::decode(iv).map_err(|err| anyhow!("Unable to base64 decode iv: {}", err))?;
let salt =
Expand Down
2 changes: 1 addition & 1 deletion validator-api/src/network_monitor/monitor/processor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ impl ReceivedProcessor {
self.permit_changer = Some(permit_sender);

tokio::spawn(async move {
while let Some(permit) = wait_for_permit(&mut permit_receiver, &*inner).await {
while let Some(permit) = wait_for_permit(&mut permit_receiver, &inner).await {
receive_or_release_permit(&mut permit_receiver, permit).await;
}

Expand Down

0 comments on commit e44ddc4

Please sign in to comment.