diff --git a/account-decoder/src/parse_token.rs b/account-decoder/src/parse_token.rs index b1bccfc537..41efcb5557 100644 --- a/account-decoder/src/parse_token.rs +++ b/account-decoder/src/parse_token.rs @@ -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), diff --git a/clap-utils/src/input_parsers.rs b/clap-utils/src/input_parsers.rs index 5e1f2d44f0..d2b77d69bf 100644 --- a/clap-utils/src/input_parsers.rs +++ b/clap-utils/src/input_parsers.rs @@ -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] diff --git a/cli-output/src/cli_output.rs b/cli-output/src/cli_output.rs index 51eab27ac6..f32b08b6f3 100644 --- a/cli-output/src/cli_output.rs +++ b/cli-output/src/cli_output.rs @@ -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()], } diff --git a/cli-output/src/display.rs b/cli-output/src/display.rs index f1d52c1f67..4ae569a6ff 100644 --- a/cli-output/src/display.rs +++ b/cli-output/src/display.rs @@ -338,7 +338,7 @@ pub fn write_transaction( 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( } 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) )?; } } diff --git a/core/src/cluster_nodes.rs b/core/src/cluster_nodes.rs index ff0ce1124c..7ca962b213 100644 --- a/core/src/cluster_nodes.rs +++ b/core/src/cluster_nodes.rs @@ -33,6 +33,7 @@ use { }, }; +#[allow(clippy::large_enum_variant)] enum NodeId { // TVU node obtained through gossip (staked or not). ContactInfo(ContactInfo), diff --git a/core/src/fetch_stage.rs b/core/src/fetch_stage.rs index 239db3199b..b99b569e03 100644 --- a/core/src/fetch_stage.rs +++ b/core/src/fetch_stage.rs @@ -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); } diff --git a/frozen-abi/macro/src/lib.rs b/frozen-abi/macro/src/lib.rs index ee0a4fdf2b..1c70ce1867 100644 --- a/frozen-abi/macro/src/lib.rs +++ b/frozen-abi/macro/src/lib.rs @@ -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)] diff --git a/ledger-tool/src/main.rs b/ledger-tool/src/main.rs index f9ace59e8d..880389aa11 100644 --- a/ledger-tool/src/main.rs +++ b/ledger-tool/src/main.rs @@ -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)) diff --git a/ledger/src/blockstore_processor.rs b/ledger/src/blockstore_processor.rs index ea816d12bf..a3bbc33ca1 100644 --- a/ledger/src/blockstore_processor.rs +++ b/ledger/src/blockstore_processor.rs @@ -1355,6 +1355,7 @@ fn process_single_slot( Ok(()) } +#[allow(clippy::large_enum_variant)] pub enum TransactionStatusMessage { Batch(TransactionStatusBatch), Freeze(Slot), diff --git a/log-analyzer/src/main.rs b/log-analyzer/src/main.rs index a49a84b08a..0b488976b4 100644 --- a/log-analyzer/src/main.rs +++ b/log-analyzer/src/main.rs @@ -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 ) diff --git a/programs/bpf_loader/build.rs b/programs/bpf_loader/build.rs index 2c665cd93f..e0a09cf7f3 100644 --- a/programs/bpf_loader/build.rs +++ b/programs/bpf_loader/build.rs @@ -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(); } } diff --git a/rpc/src/rpc.rs b/rpc/src/rpc.rs index ea9c8245d4..07b49b2bdf 100644 --- a/rpc/src/rpc.rs +++ b/rpc/src/rpc.rs @@ -1999,6 +1999,7 @@ fn verify_transaction( transaction: &SanitizedTransaction, feature_set: &Arc, ) -> 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!({ diff --git a/rpc/src/rpc_pubsub.rs b/rpc/src/rpc_pubsub.rs index 250cf758b5..1f27a798bf 100644 --- a/rpc/src/rpc_pubsub.rs +++ b/rpc/src/rpc_pubsub.rs @@ -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); diff --git a/tokens/src/args.rs b/tokens/src/args.rs index a83c7e182e..b1f1522e15 100644 --- a/tokens/src/args.rs +++ b/tokens/src/args.rs @@ -42,6 +42,7 @@ pub struct TransactionLogArgs { pub output_path: String, } +#[allow(clippy::large_enum_variant)] pub enum Command { DistributeTokens(DistributeTokensArgs), Balances(BalancesArgs), diff --git a/tokens/src/commands.rs b/tokens/src/commands.rs index b5815e80d8..718f8947fd 100644 --- a/tokens/src/commands.rs +++ b/tokens/src/commands.rs @@ -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( diff --git a/tokens/src/db.rs b/tokens/src/db.rs index bd250597c7..9d3bb6ed82 100644 --- a/tokens/src/db.rs +++ b/tokens/src/db.rs @@ -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); diff --git a/validator/src/bootstrap.rs b/validator/src/bootstrap.rs index be67c66bce..4f11f589e7 100644 --- a/validator/src/bootstrap.rs +++ b/validator/src/bootstrap.rs @@ -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))?; diff --git a/validator/src/dashboard.rs b/validator/src/dashboard.rs index 7417994e60..436c4a1ea3 100644 --- a/validator/src/dashboard.rs +++ b/validator/src/dashboard.rs @@ -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)); } }