Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 2 additions & 5 deletions src/blocks/chain4u.rs
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ impl Chain4UInner {
})
.unique()
.map(|it| &self.ident2header[it])
.collect::<Vec<_>>();
.collect_vec();

let parent_tipset =
match Tipset::new(parents.iter().map(|it| &self.ident2header[*it]).cloned()) {
Expand Down Expand Up @@ -315,10 +315,7 @@ impl Chain4UInner {

// Miner
////////
let sibling_miner_addresses = siblings
.iter()
.map(|it| it.miner_address)
.collect::<Vec<_>>();
let sibling_miner_addresses = siblings.iter().map(|it| it.miner_address).collect_vec();
assert!(sibling_miner_addresses.iter().all_unique());
match header.miner_address.inner {
None => {
Expand Down
4 changes: 2 additions & 2 deletions src/blocks/tipset.rs
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ impl TipsetKey {
self.to_cids()
.into_iter()
.map(terse_cid)
.collect::<Vec<_>>()
.collect_vec()
.join(", ")
}

Expand All @@ -127,7 +127,7 @@ impl fmt::Display for TipsetKey {
.to_cids()
.into_iter()
.map(|cid| cid.to_string())
.collect::<Vec<_>>()
.collect_vec()
.join(", ");
write!(f, "[{s}]")
}
Expand Down
8 changes: 2 additions & 6 deletions src/chain/store/tipset_tracker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ impl<DB: Blockstore> TipsetTracker<DB> {
#[cfg(test)]
mod test {
use crate::db::MemoryDB;
use itertools::Itertools as _;

use super::*;

Expand All @@ -140,12 +141,7 @@ mod test {

tipset_tracker.prune_entries(head_epoch);

let keys = tipset_tracker
.entries
.lock()
.keys()
.cloned()
.collect::<Vec<_>>();
let keys = tipset_tracker.entries.lock().keys().cloned().collect_vec();

assert_eq!(
keys,
Expand Down
4 changes: 2 additions & 2 deletions src/chain_sync/chain_follower.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1037,9 +1037,9 @@ mod tests {
.map(|v| {
v.into_iter()
.map(|ts| ts.weight().to_i64().unwrap_or(0))
.collect()
.collect_vec()
})
.collect::<Vec<Vec<_>>>();
.collect_vec();

// Both chains should start at the same tipset
assert_eq!(chains, vec![vec![1, 3], vec![1, 2]]);
Expand Down
6 changes: 1 addition & 5 deletions src/chain_sync/tipset_syncer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,11 +84,7 @@ impl TipsetSyncerError {
/// Concatenate all validation error messages into one comma separated
/// version.
fn concat(errs: NonEmpty<TipsetSyncerError>) -> Self {
let msg = errs
.iter()
.map(|e| e.to_string())
.collect::<Vec<_>>()
.join(", ");
let msg = errs.iter().map(|e| e.to_string()).collect_vec().join(", ");

TipsetSyncerError::Validation(msg)
}
Expand Down
3 changes: 2 additions & 1 deletion src/cli/humantoken.rs
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ mod parse {
use crate::shim::econ::TokenAmount;
use anyhow::{anyhow, bail};
use bigdecimal::{BigDecimal, ParseBigDecimalError};
use itertools::Itertools as _;
use nom::{
IResult, Parser,
bytes::complete::tag,
Expand Down Expand Up @@ -207,7 +208,7 @@ mod parse {
.chain(scale.units)
.map(move |prefix| (*prefix, scale))
})
.collect::<Vec<_>>();
.collect_vec();
scales.sort_by_key(|(prefix, _)| std::cmp::Reverse(*prefix));

for (prefix, scale) in scales {
Expand Down
3 changes: 2 additions & 1 deletion src/cli/subcommands/mpool_cmd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,7 @@ mod tests {
use crate::message::{Message, SignedMessage};
use crate::message_pool::tests::create_smsg;
use crate::shim::crypto::SignatureType;
use itertools::Itertools as _;
use std::borrow::BorrowMut;

#[test]
Expand All @@ -300,7 +301,7 @@ mod tests {
smsg_vec.push(msg);
}

let smsg_json_vec = smsg_vec.clone().into_iter().collect::<Vec<_>>();
let smsg_json_vec = smsg_vec.clone().into_iter().collect_vec();

// No filtering is set up
let smsg_filtered: Vec<SignedMessage> = filter_messages(smsg_json_vec, None, &None, &None)
Expand Down
3 changes: 2 additions & 1 deletion src/cli_shared/cli/completion_cmd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ use crate::wallet::subcommands::Cli as ForestWalletCli;
use ahash::HashMap;
use clap::{Command, CommandFactory};
use clap_complete::aot::{Shell, generate};
use itertools::Itertools as _;

/// Completion Command for generating shell completions for the CLI
#[derive(Debug, clap::Args)]
Expand All @@ -29,7 +30,7 @@ impl CompletionCommand {
("forest-tool".to_string(), ForestToolCli::command()),
]);

let valid_binaries = bin_cmd_map.keys().cloned().collect::<Vec<_>>();
let valid_binaries = bin_cmd_map.keys().cloned().collect_vec();
let binaries = self.binaries.unwrap_or_else(|| valid_binaries.clone());

for b in binaries {
Expand Down
3 changes: 2 additions & 1 deletion src/db/parity_db.rs
Original file line number Diff line number Diff line change
Expand Up @@ -397,6 +397,7 @@ mod test {
use super::*;
use crate::db::{BlockstoreWriteOpsSubscribable, tests::db_utils::parity::TempParityDB};
use fvm_ipld_encoding::IPLD_RAW;
use itertools::Itertools as _;
use nom::AsBytes;
use std::ops::Deref;

Expand Down Expand Up @@ -502,7 +503,7 @@ mod test {
entry.push(255);
entry
})
.collect::<Vec<Vec<u8>>>();
.collect_vec();

let cids = [
Cid::new_v1(DAG_CBOR, MultihashCode::Blake2b256.digest(&data[0])),
Expand Down
7 changes: 4 additions & 3 deletions src/lotus_json/actors/params/miner_params.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ use fil_actors_shared::v16::reward::FilterEstimate;
use fvm_ipld_encoding::{BytesDe, RawBytes};
use fvm_shared4::deal::DealID;
use fvm_shared4::sector::RegisteredUpdateProof;
use itertools::Itertools as _;
use num::BigInt;
use pastey::paste;
use schemars::JsonSchema;
Expand Down Expand Up @@ -2401,7 +2402,7 @@ macro_rules! impl_lotus_json_for_miner_prove_commit_sectors3_params {
p.notify
.into_iter()
.map(|n| n.into_lotus_json())
.collect::<Vec<_>>()
.collect_vec()
),
}).collect(),
}).collect(),
Expand Down Expand Up @@ -2527,7 +2528,7 @@ macro_rules! impl_lotus_json_for_miner_prove_replica_updates3_params {
p.notify
.into_iter()
.map(|n| n.into_lotus_json())
.collect::<Vec<_>>()
.collect_vec()
),
}).collect(),
}).collect(),
Expand Down Expand Up @@ -3156,7 +3157,7 @@ macro_rules! impl_lotus_json_for_miner_sector_activation_manifest {
self.notify
.into_iter()
.map(|n| n.into_lotus_json())
.collect::<Vec<_>>()
.collect_vec()
),
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/message_pool/msgpool/msg_pool.rs
Original file line number Diff line number Diff line change
Expand Up @@ -427,7 +427,7 @@ where
/// Loads local messages to the message pool to be applied.
pub fn load_local(&mut self) -> Result<(), Error> {
let mut local_msgs = self.local_msgs.write();
for k in local_msgs.iter().cloned().collect::<Vec<SignedMessage>>() {
for k in local_msgs.iter().cloned().collect_vec() {
self.add(k.clone()).unwrap_or_else(|err| {
if err == Error::SequenceTooLow {
warn!("error adding message: {:?}", err);
Expand Down
2 changes: 1 addition & 1 deletion src/networks/actors_bundle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ pub async fn generate_actor_bundle(output: &Path) -> anyhow::Result<()> {

roots.sort(); // deterministic

let mut blocks = blocks.into_iter().flatten().collect::<Vec<_>>();
let mut blocks = blocks.into_iter().flatten().collect_vec();
blocks.sort();
blocks.dedup();

Expand Down
3 changes: 2 additions & 1 deletion src/rpc/filter_list.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// Copyright 2019-2026 ChainSafe Systems
// SPDX-License-Identifier: Apache-2.0, MIT

use itertools::Itertools as _;
use std::path::Path;

/// A filter list that allows or rejects RPC methods based on their name.
Expand Down Expand Up @@ -47,7 +48,7 @@ impl FilterList {
let reject = reject
.into_iter()
.map(|entry| entry.trim_start_matches('!').to_owned())
.collect::<Vec<_>>();
.collect_vec();

Ok((allow, reject))
}
Expand Down
3 changes: 2 additions & 1 deletion src/rpc/methods/chain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1561,6 +1561,7 @@ mod tests {
networks::{self, ChainConfig},
};
use PathChange::{Apply, Revert};
use itertools::Itertools as _;
use std::sync::Arc;

#[test]
Expand Down Expand Up @@ -1758,7 +1759,7 @@ mod tests {
PathChange::Revert(it) => PathChange::Revert(it.make_tipset()),
PathChange::Apply(it) => PathChange::Apply(it.make_tipset()),
})
.collect::<Vec<_>>();
.collect_vec();
if expected != actual {
println!("SUMMARY");
println!("=======");
Expand Down
2 changes: 1 addition & 1 deletion src/rpc/methods/eth.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4121,7 +4121,7 @@ impl RpcMethod<1> for EthTraceFilter {
trace.trace.trace_address.clone(),
)
})
.collect::<Vec<_>>())
.collect_vec())
}
}

Expand Down
3 changes: 2 additions & 1 deletion src/rpc/methods/gas.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ use crate::state_manager::StateLookupPolicy;
use anyhow::{Context, Result};
use enumflags2::BitFlags;
use fvm_ipld_blockstore::Blockstore;
use itertools::Itertools as _;
use num::BigInt;
use num_traits::{FromPrimitive, Zero};
use rand_distr::{Distribution, Normal};
Expand Down Expand Up @@ -233,7 +234,7 @@ impl GasEstimateGasLimit {

let pending = data.mpool.pending_for(&from_a);
let prior_messages: Vec<ChainMessage> = pending
.map(|s| s.into_iter().map(ChainMessage::Signed).collect::<Vec<_>>())
.map(|s| s.into_iter().map(ChainMessage::Signed).collect_vec())
.unwrap_or_default();

let ts = data.mpool.current_tipset();
Expand Down
3 changes: 2 additions & 1 deletion src/rpc/types/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

use super::*;
use crate::lotus_json::HasLotusJson as _;
use itertools::Itertools as _;
use quickcheck_macros::quickcheck;

#[quickcheck]
Expand Down Expand Up @@ -33,7 +34,7 @@ fn test_api_tipset_key_inner(cids: Vec<Cid>) {
let api_ts = api_ts_lotus_json.into_inner();
let cids_from_api_ts = api_ts
.0
.map(|ts| ts.into_cids().into_iter().collect::<Vec<Cid>>())
.map(|ts| ts.into_cids().into_iter().collect_vec())
.unwrap_or_default();
assert_eq!(cids_from_api_ts, cids);
}
3 changes: 2 additions & 1 deletion src/rpc/types/tsk_impl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

use super::*;
use crate::lotus_json::HasLotusJson;
use itertools::Itertools as _;

impl From<TipsetKey> for ApiTipsetKey {
fn from(value: TipsetKey) -> Self {
Expand All @@ -28,7 +29,7 @@ impl HasLotusJson for ApiTipsetKey {

fn into_lotus_json(self) -> Self::LotusJson {
self.0
.map(|ts| ts.into_cids().into_iter().collect::<Vec<Cid>>())
.map(|ts| ts.into_cids().into_iter().collect_vec())
.unwrap_or_default()
.into_lotus_json()
}
Expand Down
2 changes: 1 addition & 1 deletion src/shim/machine/manifest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ impl Serialize for BuiltinActorManifest {
.builtin2cid
.iter()
.map(|(&k, v)| (k.name(), k as i32, v.to_string()))
.collect::<Vec<_>>();
.collect_vec();
let actor_list_cid = self.actor_list_cid.to_string();
let mut map = serializer.serialize_map(Some(2))?;
map.serialize_entry("actors", &builtin2cid)?;
Expand Down
5 changes: 3 additions & 2 deletions src/statediff/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ use cid::Cid;
use colored::*;
use fvm_ipld_blockstore::Blockstore;
use ipld_core::ipld::Ipld;
use itertools::Itertools as _;
use resolve::resolve_cids_recursive;
use serde::{Deserialize, Serialize};
use similar::{ChangeTag, TextDiff};
Expand Down Expand Up @@ -97,11 +98,11 @@ fn try_print_actor_states<BS: Blockstore>(
let expected = expected_pp
.split(COMMA)
.map(|s| s.trim_start_matches('\n'))
.collect::<Vec<&str>>();
.collect_vec();
let calculated = calc_pp
.split(COMMA)
.map(|s| s.trim_start_matches('\n'))
.collect::<Vec<&str>>();
.collect_vec();
let diffs = TextDiff::from_slices(&expected, &calculated);
let stdout = stdout();
let mut handle = stdout.lock();
Expand Down
4 changes: 2 additions & 2 deletions src/tool/subcommands/archive_cmd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1148,14 +1148,14 @@ mod tests {
fn steps_in_range_1() {
let range = 30_000..60_001;
let lite = steps_in_range(&range, 30_000, 800);
assert_eq!(lite.collect::<Vec<_>>(), vec![60_000]);
assert_eq!(lite.collect_vec(), vec![60_000]);
}

#[test]
fn steps_in_range_2() {
let range = (30_000 - 800)..60_001;
let lite = steps_in_range(&range, 30_000, 800);
assert_eq!(lite.collect::<Vec<_>>(), vec![30_000, 60_000]);
assert_eq!(lite.collect_vec(), vec![30_000, 60_000]);
}

#[tokio::test]
Expand Down
2 changes: 1 addition & 1 deletion src/tool/subcommands/backup_cmd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -422,7 +422,7 @@ mod test {
.filter_map(Result::ok)
.map(|entry| entry.path().strip_prefix(dir).unwrap().to_path_buf())
.sorted()
.collect::<Vec<PathBuf>>()
.collect_vec()
};
let restored = get_entries_recurse(restore_dir.path());
let original = get_entries_recurse(&data_dir);
Expand Down
5 changes: 3 additions & 2 deletions src/tool/subcommands/shed_cmd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ use base64::{Engine, prelude::BASE64_STANDARD};
use clap::Subcommand;
use clap::ValueEnum;
use futures::{StreamExt as _, TryFutureExt as _, TryStreamExt as _};
use itertools::Itertools as _;
use openrpc_types::ReferenceOr;
use std::path::PathBuf;

Expand Down Expand Up @@ -97,7 +98,7 @@ impl ShedCommands {
)
.map_ok(|tipset| {
let cids = tipset.block_headers().iter().map(|it| *it.cid());
(tipset.epoch(), cids.collect::<Vec<_>>())
(tipset.epoch(), cids.collect_vec())
})
}))
.buffered(12);
Expand Down Expand Up @@ -140,7 +141,7 @@ impl ShedCommands {
path,
omit,
} => {
let include = include.iter().map(String::as_str).collect::<Vec<_>>();
let include = include.iter().map(String::as_str).collect_vec();

let mut openrpc_doc = crate::rpc::openrpc(
path,
Expand Down
Loading