Skip to content

Commit

Permalink
Use collect() to avoid a lint
Browse files Browse the repository at this point in the history
  • Loading branch information
teor2345 committed Jan 18, 2021
1 parent b0fcef2 commit 3a9e5e4
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 18 deletions.
9 changes: 0 additions & 9 deletions zebra-test/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,6 @@

// Each lazy_static variable uses additional recursion
#![recursion_limit = "256"]
// Disable some broken or unwanted clippy nightly lints
// Build without warnings on nightly 2021-01-17 and later and stable 1.51 and later
#![allow(unknown_lints)]
// Disable old lint warnings on nightly until 1.51 is stable
#![allow(renamed_and_removed_lints)]
// Use the old lint name to build without warnings on stable until 1.51 is stable
#![allow(clippy::unknown_clippy_lints)]
// The actual lints we want to disable
#![allow(clippy::from_iter_instead_of_collect)]

use color_eyre::section::PanicMessage;
use owo_colors::OwoColorize;
Expand Down
14 changes: 5 additions & 9 deletions zebra-test/src/vectors/block.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
use hex::FromHex;
use lazy_static::lazy_static;

use std::{collections::BTreeMap, iter::FromIterator};
use std::collections::BTreeMap;

lazy_static! {

Expand All @@ -22,8 +22,7 @@ lazy_static! {
/// Mainnet blocks, indexed by height
///
/// This is actually a bijective map, the tests ensure that values are unique.
pub static ref MAINNET_BLOCKS: BTreeMap<u32, &'static [u8]> = BTreeMap::from_iter(
[
pub static ref MAINNET_BLOCKS: BTreeMap<u32, &'static [u8]> = [
// Genesis
(0, BLOCK_MAINNET_GENESIS_BYTES.as_ref()),
// BeforeOverwinter
Expand Down Expand Up @@ -62,14 +61,12 @@ lazy_static! {
(975_066, BLOCK_MAINNET_975066_BYTES.as_ref()),
(982_681, BLOCK_MAINNET_982681_BYTES.as_ref()),
// TODO: Canopy and First Halving, see #1099
].iter().cloned()
);
].iter().cloned().collect();

/// Testnet blocks, indexed by height
///
/// This is actually a bijective map, the tests ensure that values are unique.
pub static ref TESTNET_BLOCKS: BTreeMap<u32, &'static [u8]> = BTreeMap::from_iter(
[
pub static ref TESTNET_BLOCKS: BTreeMap<u32, &'static [u8]> = [
// Genesis
(0, BLOCK_TESTNET_GENESIS_BYTES.as_ref()),
// BeforeOverwinter
Expand Down Expand Up @@ -120,8 +117,7 @@ lazy_static! {
// Shielded coinbase
(1_101_629, BLOCK_TESTNET_1101629_BYTES.as_ref()),
// TODO: First Halving, see #1104
].iter().cloned()
);
].iter().cloned().collect();

// Mainnet

Expand Down

0 comments on commit 3a9e5e4

Please sign in to comment.