Przeglądaj źródła

chore: remove unused clippy attributes, needless_collect (#1517)

* remove clippy needless_collect

* update comment
Yihau Chen 1 rok temu
rodzic
commit
c59fa1ea77

+ 0 - 3
accounts-db/src/accounts.rs

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

+ 0 - 1
accounts-db/src/accounts_db.rs

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

+ 0 - 1
accounts-db/src/accounts_index.rs

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

+ 0 - 3
gossip/src/cluster_info.rs

@@ -2307,7 +2307,6 @@ impl ClusterInfo {
         }
     }
 
-    #[allow(clippy::needless_collect)]
     fn handle_batch_push_messages(
         &self,
         messages: Vec<(Pubkey, Vec<CrdsValue>)>,
@@ -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());
@@ -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

+ 0 - 1
gossip/src/crds.rs

@@ -1383,7 +1383,6 @@ mod tests {
     }
 
     #[test]
-    #[allow(clippy::needless_collect)]
     fn test_drop() {
         fn num_unique_pubkeys<'a, I>(values: I) -> usize
         where

+ 0 - 1
perf/src/recycler.rs

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

+ 0 - 1
programs/sbf/tests/programs.rs

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

+ 0 - 1
runtime/src/bank/fee_distribution.rs

@@ -210,7 +210,6 @@ impl Bank {
     // fees
     //
     // Ref: distribute_transaction_fees
-    #[allow(clippy::needless_collect)]
     fn distribute_rent_to_validators(
         &self,
         vote_accounts: &VoteAccountsHashMap,

+ 1 - 3
runtime/src/bank_forks.rs

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

+ 0 - 1
runtime/src/snapshot_utils.rs

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

+ 0 - 1
tokens/src/commands.rs

@@ -504,7 +504,6 @@ fn distribute_allocations(
     Ok(())
 }
 
-#[allow(clippy::needless_collect)]
 fn read_allocations(
     input_csv: &str,
     transfer_amount: Option<u64>,