add iter_on_single_itemsclippy lint (#8542)

This commit is contained in:
Thomas Coratger
2024-06-01 18:30:26 +02:00
committed by GitHub
parent b311de91cf
commit e75edf3be7
3 changed files with 8 additions and 9 deletions

View File

@ -155,6 +155,7 @@ useless_let_if_seq = "warn"
use_self = "warn"
missing_const_for_fn = "warn"
empty_line_after_doc_comments = "warn"
iter_on_single_items = "warn"
# These are nursery lints which have findings. Allow them for now. Some are not
# quite mature enough for use in our codebase and some we don't really want.
@ -165,7 +166,6 @@ collection_is_never_read = "allow"
debug_assert_with_mut_call = "allow"
fallible_impl_from = "allow"
future_not_send = "allow"
iter_on_single_items = "allow"
needless_collect = "allow"
non_send_fields_in_send_ty = "allow"
redundant_pub_crate = "allow"

View File

@ -2325,7 +2325,7 @@ mod tests {
chain_spec.clone(),
StaticFileProvider::read_write(static_dir_path).unwrap(),
),
[&next_head].into_iter(),
std::iter::once(&next_head),
);
let expected_result = ForkchoiceUpdated::from_status(PayloadStatusEnum::Syncing);
@ -2695,7 +2695,7 @@ mod tests {
chain_spec.clone(),
StaticFileProvider::read_write(static_dir_path).unwrap(),
),
[&genesis].into_iter(),
std::iter::once(&genesis),
);
let mut engine_rx = spawn_consensus_engine(consensus_engine);

View File

@ -689,7 +689,7 @@ mod tests {
let tx = db.tx().unwrap();
let factory = HashedPostStateCursorFactory::new(&tx, &sorted);
let expected =
[(address, db_storage.into_iter().chain(post_state_storage).collect())].into_iter();
std::iter::once((address, db_storage.into_iter().chain(post_state_storage).collect()));
assert_storage_cursor_order(&factory, expected);
}
@ -724,11 +724,10 @@ mod tests {
let sorted = hashed_post_state.into_sorted();
let tx = db.tx().unwrap();
let factory = HashedPostStateCursorFactory::new(&tx, &sorted);
let expected = [(
let expected = std::iter::once((
address,
post_state_storage.into_iter().filter(|(_, value)| *value > U256::ZERO).collect(),
)]
.into_iter();
));
assert_storage_cursor_order(&factory, expected);
}
@ -762,7 +761,7 @@ mod tests {
let sorted = hashed_post_state.into_sorted();
let tx = db.tx().unwrap();
let factory = HashedPostStateCursorFactory::new(&tx, &sorted);
let expected = [(address, post_state_storage)].into_iter();
let expected = std::iter::once((address, post_state_storage));
assert_storage_cursor_order(&factory, expected);
}
@ -797,7 +796,7 @@ mod tests {
let sorted = hashed_post_state.into_sorted();
let tx = db.tx().unwrap();
let factory = HashedPostStateCursorFactory::new(&tx, &sorted);
let expected = [(address, storage)].into_iter();
let expected = std::iter::once((address, storage));
assert_storage_cursor_order(&factory, expected);
}