Skip to content

Commit

Permalink
fixes errors from clippy::needless_borrow (solana-labs#29535)
Browse files Browse the repository at this point in the history
  • Loading branch information
behzadnouri authored and gnapoli23 committed Jan 10, 2023
1 parent df8205b commit 08ae65d
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 14 deletions.
4 changes: 2 additions & 2 deletions cli/src/program.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2723,7 +2723,7 @@ mod tests {
let program_pubkey = Pubkey::new_unique();
let new_authority_pubkey = Keypair::new();
let new_authority_pubkey_file = make_tmp_path("authority_keypair_file");
write_keypair_file(&new_authority_pubkey, &new_authority_pubkey_file).unwrap();
write_keypair_file(&new_authority_pubkey, new_authority_pubkey_file).unwrap();
let test_command = test_commands.clone().get_matches_from(vec![
"test",
"program",
Expand Down Expand Up @@ -3109,7 +3109,7 @@ mod tests {
let program_keypair_location = program_location.with_file_name("noop-keypair.json");
std::fs::create_dir_all(deploy_path).unwrap();
std::fs::copy(pathbuf, program_location.as_os_str()).unwrap();
write_keypair_file(&program_pubkey, &program_keypair_location).unwrap();
write_keypair_file(&program_pubkey, program_keypair_location).unwrap();

let config = CliConfig {
rpc_client: Some(Arc::new(RpcClient::new_mock("".to_string()))),
Expand Down
2 changes: 1 addition & 1 deletion ledger/src/blockstore.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3894,7 +3894,7 @@ pub fn create_new_ledger(
blockstore_dir,
];
let output = std::process::Command::new("tar")
.args(&args)
.args(args)
.output()
.unwrap();
if !output.status.success() {
Expand Down
6 changes: 3 additions & 3 deletions ledger/src/blockstore_db.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1574,12 +1574,12 @@ where
impl<'a> WriteBatch<'a> {
pub fn put_bytes<C: Column + ColumnName>(&mut self, key: C::Index, bytes: &[u8]) -> Result<()> {
self.write_batch
.put_cf(self.get_cf::<C>(), &C::key(key), bytes);
.put_cf(self.get_cf::<C>(), C::key(key), bytes);
Ok(())
}

pub fn delete<C: Column + ColumnName>(&mut self, key: C::Index) -> Result<()> {
self.write_batch.delete_cf(self.get_cf::<C>(), &C::key(key));
self.write_batch.delete_cf(self.get_cf::<C>(), C::key(key));
Ok(())
}

Expand All @@ -1590,7 +1590,7 @@ impl<'a> WriteBatch<'a> {
) -> Result<()> {
let serialized_value = serialize(&value)?;
self.write_batch
.put_cf(self.get_cf::<C>(), &C::key(key), &serialized_value);
.put_cf(self.get_cf::<C>(), C::key(key), serialized_value);
Ok(())
}

Expand Down
2 changes: 1 addition & 1 deletion remote-wallet/src/ledger.rs
Original file line number Diff line number Diff line change
Expand Up @@ -632,7 +632,7 @@ pub fn get_ledger_from_info(

let wallet_host_device_path = if host_device_paths.len() > 1 {
let selection = Select::with_theme(&ColorfulTheme::default())
.with_prompt(&format!(
.with_prompt(format!(
"Multiple hardware wallets found. Please select a device for {keypair_name:?}"
))
.default(0)
Expand Down
2 changes: 1 addition & 1 deletion runtime/src/append_vec/test_utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ pub fn get_append_vec_path(path: &str) -> TempFile {
.collect();
let dir = format!("{out_dir}/{rand_string}");
let mut buf = PathBuf::new();
buf.push(&format!("{dir}/{path}"));
buf.push(format!("{dir}/{path}"));
std::fs::create_dir_all(dir).expect("Create directory failed");
TempFile { path: buf }
}
Expand Down
12 changes: 6 additions & 6 deletions tokens/src/commands.rs
Original file line number Diff line number Diff line change
Expand Up @@ -925,7 +925,7 @@ pub fn test_process_distribute_tokens_with_client(
let input_csv = allocations_file.path().to_str().unwrap().to_string();
let mut wtr = csv::WriterBuilder::new().from_writer(allocations_file);
wtr.write_record(["recipient", "amount"]).unwrap();
wtr.write_record(&[
wtr.write_record([
alice_pubkey.to_string(),
lamports_to_sol(expected_amount).to_string(),
])
Expand Down Expand Up @@ -1026,7 +1026,7 @@ pub fn test_process_create_stake_with_client(client: &RpcClient, sender_keypair:
let mut wtr = csv::WriterBuilder::new().from_writer(file);
wtr.write_record(["recipient", "amount", "lockup_date"])
.unwrap();
wtr.write_record(&[
wtr.write_record([
alice_pubkey.to_string(),
lamports_to_sol(expected_amount).to_string(),
"".to_string(),
Expand Down Expand Up @@ -1148,7 +1148,7 @@ pub fn test_process_distribute_stake_with_client(client: &RpcClient, sender_keyp
let mut wtr = csv::WriterBuilder::new().from_writer(file);
wtr.write_record(["recipient", "amount", "lockup_date"])
.unwrap();
wtr.write_record(&[
wtr.write_record([
alice_pubkey.to_string(),
lamports_to_sol(expected_amount).to_string(),
"".to_string(),
Expand Down Expand Up @@ -1414,9 +1414,9 @@ mod tests {
let input_csv = file.path().to_str().unwrap().to_string();
let mut wtr = csv::WriterBuilder::new().from_writer(file);
wtr.serialize("recipient".to_string()).unwrap();
wtr.serialize(&pubkey0.to_string()).unwrap();
wtr.serialize(&pubkey1.to_string()).unwrap();
wtr.serialize(&pubkey2.to_string()).unwrap();
wtr.serialize(pubkey0.to_string()).unwrap();
wtr.serialize(pubkey1.to_string()).unwrap();
wtr.serialize(pubkey2.to_string()).unwrap();
wtr.flush().unwrap();

let amount = sol_to_lamports(1.5);
Expand Down

0 comments on commit 08ae65d

Please sign in to comment.