This commit is contained in:
Michael Vines 2021-10-22 21:25:54 -07:00 committed by mergify[bot]
parent 293a0d8797
commit 350bb561eb
18 changed files with 35 additions and 52 deletions

View File

@ -116,6 +116,7 @@ pub fn parse_token(
#[derive(Debug, Serialize, Deserialize, PartialEq)]
#[serde(rename_all = "camelCase", tag = "type", content = "info")]
#[allow(clippy::large_enum_variant)]
pub enum TokenAccountType {
Account(UiTokenAccount),
Mint(UiMint),

View File

@ -217,7 +217,7 @@ mod tests {
use std::env;
let out_dir = env::var("FARF_DIR").unwrap_or_else(|_| "farf".to_string());
format!("{}/tmp/{}-{}", out_dir, name, pubkey.to_string())
format!("{}/tmp/{}-{}", out_dir, name, pubkey)
}
#[test]

View File

@ -316,10 +316,10 @@ impl fmt::Display for CliEpochInfo {
"Epoch Completed Time:",
&format!(
"{}{}/{} ({} remaining)",
humantime::format_duration(time_elapsed).to_string(),
humantime::format_duration(time_elapsed),
if annotation.is_some() { "*" } else { "" },
humantime::format_duration(time_elapsed + time_remaining).to_string(),
humantime::format_duration(time_remaining).to_string(),
humantime::format_duration(time_elapsed + time_remaining),
humantime::format_duration(time_remaining),
),
)?;
if let Some(annotation) = annotation {
@ -2593,11 +2593,7 @@ mod tests {
CliSignOnlyData {
blockhash: blockhash.to_string(),
message: None,
signers: vec![format!(
"{}={}",
present.pubkey().to_string(),
tx.signatures[1]
)],
signers: vec![format!("{}={}", present.pubkey(), tx.signatures[1])],
absent: vec![absent.pubkey().to_string()],
bad_sig: vec![bad.pubkey().to_string()],
}
@ -2627,11 +2623,7 @@ mod tests {
CliSignOnlyData {
blockhash: blockhash.to_string(),
message: Some(expected_msg),
signers: vec![format!(
"{}={}",
present.pubkey().to_string(),
tx.signatures[1]
)],
signers: vec![format!("{}={}", present.pubkey(), tx.signatures[1])],
absent: vec![absent.pubkey().to_string()],
bad_sig: vec![bad.pubkey().to_string()],
}

View File

@ -338,7 +338,7 @@ pub fn write_transaction<W: io::Write>(
let sign = if reward.lamports < 0 { "-" } else { "" };
writeln!(
w,
"{} {:<44} {:^15} {:<15} {}",
"{} {:<44} {:^15} {}◎{:<14.9} ◎{:<18.9}",
prefix,
reward.pubkey,
if let Some(reward_type) = reward.reward_type {
@ -346,12 +346,9 @@ pub fn write_transaction<W: io::Write>(
} else {
"-".to_string()
},
format!(
"{}◎{:<14.9}",
sign,
lamports_to_sol(reward.lamports.abs() as u64)
),
format!("{:<18.9}", lamports_to_sol(reward.post_balance),)
sign,
lamports_to_sol(reward.lamports.abs() as u64),
lamports_to_sol(reward.post_balance)
)?;
}
}

View File

@ -33,6 +33,7 @@ use {
},
};
#[allow(clippy::large_enum_variant)]
enum NodeId {
// TVU node obtained through gossip (staked or not).
ContactInfo(ContactInfo),

View File

@ -95,6 +95,7 @@ impl FetchStage {
{
inc_new_counter_debug!("fetch_stage-honor_forwards", len);
for packets in batch {
#[allow(clippy::question_mark)]
if sendr.send(packets).is_err() {
return Err(Error::Send);
}

View File

@ -310,10 +310,7 @@ fn quote_for_test(
#[cfg(RUSTC_WITH_SPECIALIZATION)]
fn test_mod_name(type_name: &Ident) -> Ident {
Ident::new(
&format!("{}_frozen_abi", type_name.to_string()),
Span::call_site(),
)
Ident::new(&format!("{}_frozen_abi", type_name), Span::call_site())
}
#[cfg(RUSTC_WITH_SPECIALIZATION)]

View File

@ -94,19 +94,16 @@ fn output_slot_rewards(blockstore: &Blockstore, slot: Slot, method: &LedgerOutpu
for reward in rewards {
let sign = if reward.lamports < 0 { "-" } else { "" };
println!(
" {:<44} {:^15} {:<15} {} {}",
" {:<44} {:^15} {}◎{:<14.9} ◎{:<18.9} {}",
reward.pubkey,
if let Some(reward_type) = reward.reward_type {
format!("{}", reward_type)
} else {
"-".to_string()
},
format!(
"{}◎{:<14.9}",
sign,
lamports_to_sol(reward.lamports.abs() as u64)
),
format!("{:<18.9}", lamports_to_sol(reward.post_balance)),
sign,
lamports_to_sol(reward.lamports.abs() as u64),
lamports_to_sol(reward.post_balance),
reward
.commission
.map(|commission| format!("{:>9}%", commission))

View File

@ -1355,6 +1355,7 @@ fn process_single_slot(
Ok(())
}
#[allow(clippy::large_enum_variant)]
pub enum TransactionStatusMessage {
Batch(TransactionStatusBatch),
Freeze(Slot),

View File

@ -40,11 +40,9 @@ impl LogLine {
format!(
"Lost {}%, {}, ({} - {}), sender {}, receiver {}",
((v1 - v2) * 100 / v1),
Byte::from_bytes(v1 - v2)
.get_appropriate_unit(true)
.to_string(),
Byte::from_bytes(v1).get_appropriate_unit(true).to_string(),
Byte::from_bytes(v2).get_appropriate_unit(true).to_string(),
Byte::from_bytes(v1 - v2).get_appropriate_unit(true),
Byte::from_bytes(v1).get_appropriate_unit(true),
Byte::from_bytes(v2).get_appropriate_unit(true),
a,
b
)

View File

@ -29,6 +29,7 @@ fn main() {
let mut out = BufWriter::new(file);
let sysc_re = Regex::new(r#"register_syscall_by_name\([[:space:]]*b"([^"]+)","#).unwrap();
for caps in sysc_re.captures_iter(text) {
writeln!(out, "{}", caps[1].to_string()).unwrap();
let name = caps[1].to_string();
writeln!(out, "{}", name).unwrap();
}
}

View File

@ -1999,6 +1999,7 @@ fn verify_transaction(
transaction: &SanitizedTransaction,
feature_set: &Arc<feature_set::FeatureSet>,
) -> Result<()> {
#[allow(clippy::question_mark)]
if transaction.verify().is_err() {
return Err(RpcCustomError::TransactionSignatureVerificationFailure.into());
}
@ -4912,11 +4913,11 @@ pub mod tests {
r#"{"jsonrpc":"2.0","id":1,"method":"getLeaderSchedule"}"#,
&format!(
r#"{{"jsonrpc":"2.0","id":1,"method":"getLeaderSchedule", "params": [null, {{ "identity": "{}" }}]}}"#,
bank.collector_id().to_string()
bank.collector_id()
),
&format!(
r#"{{"jsonrpc":"2.0","id":1,"method":"getLeaderSchedule", "params": [{{ "identity": "{}" }}]}}"#,
bank.collector_id().to_string()
bank.collector_id()
),
]
.iter()
@ -5657,7 +5658,6 @@ pub mod tests {
"sigVerify": true,
"replaceRecentBlockhash": true,
})
.to_string()
);
let res = io.handle_request_sync(&req, meta.clone());
let expected = json!({

View File

@ -714,7 +714,7 @@ mod tests {
let tx = system_transaction::transfer(&alice, &bob_pubkey, 20, blockhash);
let req = format!(
r#"{{"jsonrpc":"2.0","id":1,"method":"signatureSubscribe","params":["{}"]}}"#,
tx.signatures[0].to_string()
tx.signatures[0]
);
let _res = io.handle_request_sync(&req);
@ -971,7 +971,7 @@ mod tests {
let req = format!(
r#"{{"jsonrpc":"2.0","id":1,"method":"accountSubscribe","params":["{}"]}}"#,
bob_pubkey.to_string()
bob_pubkey
);
let _res = io.handle_request_sync(&req);

View File

@ -42,6 +42,7 @@ pub struct TransactionLogArgs {
pub output_path: String,
}
#[allow(clippy::large_enum_variant)]
pub enum Command {
DistributeTokens(DistributeTokensArgs),
Balances(BalancesArgs),

View File

@ -1542,7 +1542,7 @@ mod tests {
use std::env;
let out_dir = env::var("FARF_DIR").unwrap_or_else(|_| "farf".to_string());
format!("{}/tmp/{}-{}", out_dir, name, pubkey.to_string())
format!("{}/tmp/{}-{}", out_dir, name, pubkey)
}
fn initialize_check_payer_balances_inputs(

View File

@ -162,11 +162,7 @@ pub fn update_finalized_transaction(
if let Some(e) = &transaction_status.err {
// The transaction was finalized, but execution failed. Drop it.
eprintln!(
"Error in transaction with signature {}: {}",
signature,
e.to_string()
);
eprintln!("Error in transaction with signature {}: {}", signature, e);
eprintln!("Discarding transaction record");
db.rem(&signature.to_string())?;
return Ok(None);

View File

@ -318,7 +318,7 @@ fn check_vote_account(
) -> Result<(), String> {
let vote_account = rpc_client
.get_account_with_commitment(vote_account_address, CommitmentConfig::confirmed())
.map_err(|err| format!("failed to fetch vote account: {}", err.to_string()))?
.map_err(|err| format!("failed to fetch vote account: {}", err))?
.value
.ok_or_else(|| format!("vote account does not exist: {}", vote_account_address))?;
@ -331,7 +331,7 @@ fn check_vote_account(
let identity_account = rpc_client
.get_account_with_commitment(identity_pubkey, CommitmentConfig::confirmed())
.map_err(|err| format!("failed to fetch identity account: {}", err.to_string()))?
.map_err(|err| format!("failed to fetch identity account: {}", err))?
.value
.ok_or_else(|| format!("identity account does not exist: {}", identity_pubkey))?;

View File

@ -108,7 +108,7 @@ impl Dashboard {
println_name_value("TPU Address:", &tpu.to_string());
}
if let Some(rpc) = contact_info.rpc {
println_name_value("JSON RPC URL:", &format!("http://{}", rpc.to_string()));
println_name_value("JSON RPC URL:", &format!("http://{}", rpc));
}
}