Skip to content

Commit

Permalink
chore: remove unused clippy attributes, needless_collect (solana-labs…
Browse files Browse the repository at this point in the history
…#1517)

* remove clippy needless_collect

* update comment
  • Loading branch information
yihau authored Jun 3, 2024
1 parent f70a94c commit c59fa1e
Show file tree
Hide file tree
Showing 11 changed files with 1 addition and 17 deletions.
3 changes: 0 additions & 3 deletions accounts-db/src/accounts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -596,7 +596,6 @@ impl Accounts {
/// This function will prevent multiple threads from modifying the same account state at the
/// same time
#[must_use]
#[allow(clippy::needless_collect)]
pub fn lock_accounts<'a>(
&self,
txs: impl Iterator<Item = &'a SanitizedTransaction>,
Expand All @@ -609,7 +608,6 @@ impl Accounts {
}

#[must_use]
#[allow(clippy::needless_collect)]
pub fn lock_accounts_with_results<'a>(
&self,
txs: impl Iterator<Item = &'a SanitizedTransaction>,
Expand Down Expand Up @@ -646,7 +644,6 @@ impl Accounts {
}

/// Once accounts are unlocked, new transactions that modify that state can enter the pipeline
#[allow(clippy::needless_collect)]
pub fn unlock_accounts<'a>(
&self,
txs_and_results: impl Iterator<Item = (&'a SanitizedTransaction, &'a Result<()>)>,
Expand Down
1 change: 0 additions & 1 deletion accounts-db/src/accounts_db.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6003,7 +6003,6 @@ impl AccountsDb {
);
}

#[allow(clippy::needless_collect)]
fn purge_slots<'a>(&self, slots: impl Iterator<Item = &'a Slot> + Clone) {
// `add_root()` should be called first
let mut safety_checks_elapsed = Measure::start("safety_checks_elapsed");
Expand Down
1 change: 0 additions & 1 deletion accounts-db/src/accounts_index.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1632,7 +1632,6 @@ impl<T: IndexValue, U: DiskIndexValue + From<T> + Into<T>> AccountsIndex<T, U> {
// But, does NOT update secondary index
// This is designed to be called at startup time.
// returns (dirty_pubkeys, insertion_time_us, GenerateIndexResult)
#[allow(clippy::needless_collect)]
pub(crate) fn insert_new_if_missing_into_primary_index(
&self,
slot: Slot,
Expand Down
3 changes: 0 additions & 3 deletions gossip/src/cluster_info.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2307,7 +2307,6 @@ impl ClusterInfo {
}
}

#[allow(clippy::needless_collect)]
fn handle_batch_push_messages(
&self,
messages: Vec<(Pubkey, Vec<CrdsValue>)>,
Expand Down Expand Up @@ -3357,7 +3356,6 @@ mod tests {
}

#[test]
#[allow(clippy::needless_collect)]
fn test_handle_ping_messages() {
let mut rng = rand::thread_rng();
let this_node = Arc::new(Keypair::new());
Expand Down Expand Up @@ -4156,7 +4154,6 @@ mod tests {
}

#[test]
#[allow(clippy::needless_collect)]
fn test_split_messages_packet_size() {
// Test that if a value is smaller than payload size but too large to be wrapped in a vec
// that it is still dropped
Expand Down
1 change: 0 additions & 1 deletion gossip/src/crds.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1383,7 +1383,6 @@ mod tests {
}

#[test]
#[allow(clippy::needless_collect)]
fn test_drop() {
fn num_unique_pubkeys<'a, I>(values: I) -> usize
where
Expand Down
1 change: 0 additions & 1 deletion perf/src/recycler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,6 @@ fn warm_recyclers() -> bool {
}

impl<T: Default + Reset + Sized> Recycler<T> {
#[allow(clippy::needless_collect)]
pub fn warmed(num: usize, size_hint: usize) -> Self {
let new = Self::default();
if warm_recyclers() {
Expand Down
1 change: 0 additions & 1 deletion programs/sbf/tests/programs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
#![allow(clippy::redundant_clone)]
#![allow(clippy::needless_borrow)]
#![allow(clippy::cmp_owned)]
#![allow(clippy::needless_collect)]
#![allow(clippy::match_like_matches_macro)]
#![allow(clippy::unnecessary_cast)]
#![allow(clippy::uninlined_format_args)]
Expand Down
1 change: 0 additions & 1 deletion runtime/src/bank/fee_distribution.rs
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,6 @@ impl Bank {
// fees
//
// Ref: distribute_transaction_fees
#[allow(clippy::needless_collect)]
fn distribute_rent_to_validators(
&self,
vote_accounts: &VoteAccountsHashMap,
Expand Down
4 changes: 1 addition & 3 deletions runtime/src/bank_forks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -642,10 +642,8 @@ impl BankForks {
root: Slot,
highest_super_majority_root: Option<Slot>,
) -> (Vec<BankWithScheduler>, u64, u64) {
// Clippy doesn't like separating the two collects below,
// but we want to collect timing separately, and the 2nd requires
// We want to collect timing separately, and the 2nd collect requires
// a unique borrow to self which is already borrowed by self.banks
#![allow(clippy::needless_collect)]
let mut prune_slots_time = Measure::start("prune_slots");
let highest_super_majority_root = highest_super_majority_root.unwrap_or(root);
let prune_slots: Vec<_> = self
Expand Down
1 change: 0 additions & 1 deletion runtime/src/snapshot_utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1602,7 +1602,6 @@ fn streaming_unarchive_snapshot(
let shared_buffer = untar_snapshot_create_shared_buffer(&snapshot_archive_path, archive_format);

// All shared buffer readers need to be created before the threads are spawned
#[allow(clippy::needless_collect)]
let archives: Vec<_> = (0..num_threads)
.map(|_| {
let reader = SharedBufferReader::new(&shared_buffer);
Expand Down
1 change: 0 additions & 1 deletion tokens/src/commands.rs
Original file line number Diff line number Diff line change
Expand Up @@ -504,7 +504,6 @@ fn distribute_allocations(
Ok(())
}

#[allow(clippy::needless_collect)]
fn read_allocations(
input_csv: &str,
transfer_amount: Option<u64>,
Expand Down

0 comments on commit c59fa1e

Please sign in to comment.