fixes errors from clippy::needless_borrow (#29535)

https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow
This commit is contained in:
behzad nouri 2023-01-05 18:21:56 +00:00 committed by GitHub
parent d611cc2e75
commit d87128e02c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 14 additions and 14 deletions

View File

@ -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",
@ -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()))),

View File

@ -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() {

View File

@ -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(())
}
@ -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(())
}

View File

@ -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)

View File

@ -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 }
}

View File

@ -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(),
])
@ -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(),
@ -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(),
@ -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);