Fix Nightly Clippy Warnings (backport #18065) (#18070)

* chore: cargo +nightly clippy --fix -Z unstable-options

(cherry picked from commit 6514096a67)

# Conflicts:
#	core/src/banking_stage.rs
#	core/src/cost_model.rs
#	core/src/cost_tracker.rs
#	core/src/execute_cost_table.rs
#	core/src/replay_stage.rs
#	core/src/tvu.rs
#	ledger-tool/src/main.rs
#	programs/bpf_loader/build.rs
#	rbpf-cli/src/main.rs
#	sdk/cargo-build-bpf/src/main.rs
#	sdk/cargo-test-bpf/src/main.rs
#	sdk/src/secp256k1_instruction.rs

* chore: cargo fmt

(cherry picked from commit 789f33e8db)

* Updates BPF program assert_instruction_count tests.

(cherry picked from commit c1e03f3410)

# Conflicts:
#	programs/bpf/tests/programs.rs

* Resolve conflicts

Co-authored-by: Alexander Meißner <AlexanderMeissner@gmx.net>
Co-authored-by: Michael Vines <mvines@gmail.com>
This commit is contained in:
mergify[bot]
2021-06-18 20:02:48 +00:00
committed by GitHub
parent c330016109
commit 0e7512a225
173 changed files with 1250 additions and 1056 deletions

View File

@@ -405,7 +405,7 @@ pub fn bigtable_process_command(ledger_path: &Path, matches: &ArgMatches<'_>) {
let allow_missing_metadata = arg_matches.is_present("allow_missing_metadata");
let force_reupload = arg_matches.is_present("force_reupload");
let blockstore =
crate::open_blockstore(&ledger_path, AccessType::TryPrimaryThenSecondary, None);
crate::open_blockstore(ledger_path, AccessType::TryPrimaryThenSecondary, None);
runtime.block_on(upload(
blockstore,

View File

@@ -134,7 +134,7 @@ fn output_entry(
.map(|transaction_status| transaction_status.into());
solana_cli_output::display::println_transaction(
&transaction,
transaction,
&transaction_status,
" ",
None,
@@ -453,7 +453,7 @@ fn graph_forks(bank_forks: &BankForks, include_all_votes: bool) -> String {
let mut lowest_total_stake = 0;
for (node_pubkey, (last_vote_slot, vote_state, stake, total_stake)) in &last_votes {
all_votes.entry(*node_pubkey).and_modify(|validator_votes| {
validator_votes.remove(&last_vote_slot);
validator_votes.remove(last_vote_slot);
});
dot.push(format!(
@@ -473,7 +473,7 @@ fn graph_forks(bank_forks: &BankForks, include_all_votes: bool) -> String {
dot.push(format!(
r#" "last vote {}" -> "{}" [style=dashed,label="latest vote"];"#,
node_pubkey,
if styled_slots.contains(&last_vote_slot) {
if styled_slots.contains(last_vote_slot) {
last_vote_slot.to_string()
} else {
if *last_vote_slot < lowest_last_vote_slot {
@@ -520,7 +520,7 @@ fn graph_forks(bank_forks: &BankForks, include_all_votes: bool) -> String {
r#" "{} vote {}" -> "{}" [style=dotted,label="vote"];"#,
node_pubkey,
vote_slot,
if styled_slots.contains(&vote_slot) {
if styled_slots.contains(vote_slot) {
vote_slot.to_string()
} else {
"...".to_string()
@@ -712,8 +712,8 @@ fn load_bank_forks(
};
bank_forks_utils::load(
&genesis_config,
&blockstore,
genesis_config,
blockstore,
account_paths,
None,
snapshot_config.as_ref(),
@@ -833,7 +833,7 @@ fn main() {
.long("maximum-snapshots-to-retain")
.value_name("NUMBER")
.takes_value(true)
.default_value(&default_max_snapshot_to_retain)
.default_value(default_max_snapshot_to_retain)
.help("Maximum number of snapshots to hold on to during snapshot purge");
let rent = Rent::default();
@@ -1859,14 +1859,14 @@ fn main() {
let remove_stake_accounts = arg_matches.is_present("remove_stake_accounts");
let new_hard_forks = hardforks_of(arg_matches, "hard_forks");
let faucet_pubkey = pubkey_of(&arg_matches, "faucet_pubkey");
let faucet_pubkey = pubkey_of(arg_matches, "faucet_pubkey");
let faucet_lamports = value_t!(arg_matches, "faucet_lamports", u64).unwrap_or(0);
let rent_burn_percentage = value_t!(arg_matches, "rent_burn_percentage", u8);
let hashes_per_tick = arg_matches.value_of("hashes_per_tick");
let bootstrap_stake_authorized_pubkey =
pubkey_of(&arg_matches, "bootstrap_stake_authorized_pubkey");
pubkey_of(arg_matches, "bootstrap_stake_authorized_pubkey");
let bootstrap_validator_lamports =
value_t_or_exit!(arg_matches, "bootstrap_validator_lamports", u64);
let bootstrap_validator_stake_lamports =
@@ -1880,9 +1880,9 @@ fn main() {
);
exit(1);
}
let bootstrap_validator_pubkeys = pubkeys_of(&arg_matches, "bootstrap_validator");
let bootstrap_validator_pubkeys = pubkeys_of(arg_matches, "bootstrap_validator");
let accounts_to_remove =
pubkeys_of(&arg_matches, "accounts_to_remove").unwrap_or_default();
pubkeys_of(arg_matches, "accounts_to_remove").unwrap_or_default();
let snapshot_version =
arg_matches
.value_of("snapshot_version")
@@ -2034,9 +2034,9 @@ fn main() {
);
let vote_account = vote_state::create_account_with_authorized(
&identity_pubkey,
&identity_pubkey,
&identity_pubkey,
identity_pubkey,
identity_pubkey,
identity_pubkey,
100,
VoteState::get_rent_exempt_reserve(&rent).max(1),
);
@@ -2046,8 +2046,8 @@ fn main() {
&stake_state::create_account(
bootstrap_stake_authorized_pubkey
.as_ref()
.unwrap_or(&identity_pubkey),
&vote_pubkey,
.unwrap_or(identity_pubkey),
vote_pubkey,
&vote_account,
&rent,
bootstrap_validator_stake_lamports,
@@ -2472,7 +2472,7 @@ fn main() {
}
};
let warped_bank = Bank::new_from_parent_with_tracer(
&base_bank,
base_bank,
base_bank.collector_id(),
next_epoch,
tracer,
@@ -2489,7 +2489,7 @@ fn main() {
println!("Slot: {} => {}", base_bank.slot(), warped_bank.slot());
println!("Epoch: {} => {}", base_bank.epoch(), warped_bank.epoch());
assert_capitalization(&base_bank);
assert_capitalization(base_bank);
assert_capitalization(&warped_bank);
let interest_per_epoch = ((warped_bank.capitalization() as f64)
/ (base_bank.capitalization() as f64)
@@ -2517,7 +2517,7 @@ fn main() {
pubkey,
account,
base_bank
.get_account(&pubkey)
.get_account(pubkey)
.map(|a| a.lamports())
.unwrap_or_default(),
)
@@ -2716,7 +2716,7 @@ fn main() {
);
}
assert_capitalization(&bank);
assert_capitalization(bank);
println!("Inflation: {:?}", bank.inflation());
println!("RentCollector: {:?}", bank.rent_collector());
println!("Capitalization: {}", Sol(bank.capitalization()));

View File

@@ -39,11 +39,11 @@ fn nominal() {
let ledger_path = ledger_path.to_str().unwrap();
// Basic validation
let output = run_ledger_tool(&["-l", &ledger_path, "verify"]);
let output = run_ledger_tool(&["-l", ledger_path, "verify"]);
assert!(output.status.success());
// Print everything
let output = run_ledger_tool(&["-l", &ledger_path, "print", "-vvv"]);
let output = run_ledger_tool(&["-l", ledger_path, "print", "-vvv"]);
assert!(output.status.success());
assert_eq!(count_newlines(&output.stdout), ticks + meta_lines);
}