Remove extern crate (#5922)

* Remove extern crate
This commit is contained in:
Michael Sproul
2024-06-18 01:05:21 +10:00
committed by GitHub
parent 44c03d5d17
commit 21f3a191c5
33 changed files with 23 additions and 41 deletions

View File

@@ -1,5 +1,3 @@
extern crate slog;
mod compute_light_client_updates; mod compute_light_client_updates;
pub mod config; pub mod config;
mod metrics; mod metrics;

View File

@@ -1,6 +1,3 @@
#[macro_use]
extern crate lazy_static;
mod block_cache; mod block_cache;
mod deposit_cache; mod deposit_cache;
mod inner; mod inner;

View File

@@ -1,5 +1,7 @@
pub use lighthouse_metrics::*; pub use lighthouse_metrics::*;
use lazy_static::lazy_static;
lazy_static! { lazy_static! {
/* /*
* Eth1 blocks * Eth1 blocks

View File

@@ -1,5 +1,3 @@
extern crate alloy_consensus;
extern crate alloy_rlp;
use alloy_consensus::TxEnvelope; use alloy_consensus::TxEnvelope;
use alloy_rlp::Decodable; use alloy_rlp::Decodable;
use types::{EthSpec, ExecutionPayloadRef, Hash256, Unsigned, VersionedHash}; use types::{EthSpec, ExecutionPayloadRef, Hash256, Unsigned, VersionedHash};

View File

@@ -2,9 +2,6 @@
/// all required libp2p functionality. /// all required libp2p functionality.
/// ///
/// This crate builds and manages the libp2p services required by the beacon node. /// This crate builds and manages the libp2p services required by the beacon node.
#[macro_use]
extern crate lazy_static;
mod config; mod config;
pub mod service; pub mod service;

View File

@@ -1,5 +1,7 @@
pub use lighthouse_metrics::*; pub use lighthouse_metrics::*;
use lazy_static::lazy_static;
lazy_static! { lazy_static! {
pub static ref NAT_OPEN: Result<IntGaugeVec> = try_create_int_gauge_vec( pub static ref NAT_OPEN: Result<IntGaugeVec> = try_create_int_gauge_vec(
"nat_open", "nat_open",

View File

@@ -6,6 +6,7 @@
//! //!
//! The scoring algorithms are currently experimental. //! The scoring algorithms are currently experimental.
use crate::service::gossipsub_scoring_parameters::GREYLIST_THRESHOLD as GOSSIPSUB_GREYLIST_THRESHOLD; use crate::service::gossipsub_scoring_parameters::GREYLIST_THRESHOLD as GOSSIPSUB_GREYLIST_THRESHOLD;
use lazy_static::lazy_static;
use serde::Serialize; use serde::Serialize;
use std::time::Instant; use std::time::Instant;
use strum::AsRefStr; use strum::AsRefStr;

View File

@@ -3,6 +3,7 @@ use crate::rpc::codec::{base::BaseInboundCodec, ssz_snappy::SSZSnappyInboundCode
use futures::future::BoxFuture; use futures::future::BoxFuture;
use futures::prelude::{AsyncRead, AsyncWrite}; use futures::prelude::{AsyncRead, AsyncWrite};
use futures::{FutureExt, StreamExt}; use futures::{FutureExt, StreamExt};
use lazy_static::lazy_static;
use libp2p::core::{InboundUpgrade, UpgradeInfo}; use libp2p::core::{InboundUpgrade, UpgradeInfo};
use ssz::Encode; use ssz::Encode;
use ssz_types::VariableList; use ssz_types::VariableList;

View File

@@ -1,6 +1,3 @@
#[macro_use]
extern crate lazy_static;
/// This crate provides the network server for Lighthouse. /// This crate provides the network server for Lighthouse.
pub mod error; pub mod error;
#[allow(clippy::mutable_key_type)] // PeerId in hashmaps are no longer permitted by clippy #[allow(clippy::mutable_key_type)] // PeerId in hashmaps are no longer permitted by clippy

View File

@@ -5,6 +5,7 @@ use beacon_chain::{
sync_committee_verification::Error as SyncCommitteeError, sync_committee_verification::Error as SyncCommitteeError,
}; };
use fnv::FnvHashMap; use fnv::FnvHashMap;
use lazy_static::lazy_static;
pub use lighthouse_metrics::*; pub use lighthouse_metrics::*;
use lighthouse_network::{ use lighthouse_network::{
peer_manager::peerdb::client::ClientKind, types::GossipKind, GossipTopic, Gossipsub, peer_manager::peerdb::client::ClientKind, types::GossipKind, GossipTopic, Gossipsub,

View File

@@ -1,5 +1,3 @@
extern crate clap;
mod cli; mod cli;
mod config; mod config;

View File

@@ -7,9 +7,6 @@
//! //!
//! Provides a simple API for storing/retrieving all types that sometimes needs type-hints. See //! Provides a simple API for storing/retrieving all types that sometimes needs type-hints. See
//! tests for implementation examples. //! tests for implementation examples.
#[macro_use]
extern crate lazy_static;
mod chunk_writer; mod chunk_writer;
pub mod chunked_iter; pub mod chunked_iter;
pub mod chunked_vector; pub mod chunked_vector;

View File

@@ -1,6 +1,7 @@
pub use lighthouse_metrics::{set_gauge, try_create_int_gauge, *}; pub use lighthouse_metrics::{set_gauge, try_create_int_gauge, *};
use directory::size_of_dir; use directory::size_of_dir;
use lazy_static::lazy_static;
use std::path::Path; use std::path::Path;
lazy_static! { lazy_static! {

View File

@@ -1,5 +1,3 @@
extern crate proc_macro;
use proc_macro::TokenStream; use proc_macro::TokenStream;
use quote::quote; use quote::quote;
use syn::{parse_macro_input, DeriveInput}; use syn::{parse_macro_input, DeriveInput};

View File

@@ -16,11 +16,9 @@
//! //!
//! This implementation passes the [reference implementation //! This implementation passes the [reference implementation
//! tests](https://github.com/ethereum/eth2.0-pm/blob/6e41fcf383ebeb5125938850d8e9b4e9888389b4/interop/mocked_start/keygen_test_vector.yaml). //! tests](https://github.com/ethereum/eth2.0-pm/blob/6e41fcf383ebeb5125938850d8e9b4e9888389b4/interop/mocked_start/keygen_test_vector.yaml).
#[macro_use]
extern crate lazy_static;
use bls::{Keypair, PublicKey, SecretKey}; use bls::{Keypair, PublicKey, SecretKey};
use ethereum_hashing::hash; use ethereum_hashing::hash;
use lazy_static::lazy_static;
use num_bigint::BigUint; use num_bigint::BigUint;
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use std::fs::File; use std::fs::File;

View File

@@ -20,8 +20,7 @@
//! ## Example //! ## Example
//! //!
//! ```rust //! ```rust
//! #[macro_use] //! use lazy_static::lazy_static;
//! extern crate lazy_static;
//! use lighthouse_metrics::*; //! use lighthouse_metrics::*;
//! //!
//! // These metrics are "magically" linked to the global registry defined in `lighthouse_metrics`. //! // These metrics are "magically" linked to the global registry defined in `lighthouse_metrics`.

View File

@@ -1,6 +1,4 @@
#[macro_use] use lazy_static::lazy_static;
extern crate lazy_static;
use lighthouse_metrics::{ use lighthouse_metrics::{
inc_counter, try_create_int_counter, IntCounter, Result as MetricsResult, inc_counter, try_create_int_counter, IntCounter, Result as MetricsResult,
}; };

View File

@@ -1,5 +1,6 @@
//! Exposes [`MetricsLayer`]: A tracing layer that registers metrics of logging events. //! Exposes [`MetricsLayer`]: A tracing layer that registers metrics of logging events.
use lazy_static::lazy_static;
use lighthouse_metrics as metrics; use lighthouse_metrics as metrics;
use tracing_log::NormalizeEvent; use tracing_log::NormalizeEvent;

View File

@@ -1,6 +1,3 @@
#[macro_use]
extern crate lazy_static;
mod manual_slot_clock; mod manual_slot_clock;
mod metrics; mod metrics;
mod system_time_slot_clock; mod system_time_slot_clock;

View File

@@ -1,4 +1,5 @@
use crate::SlotClock; use crate::SlotClock;
use lazy_static::lazy_static;
pub use lighthouse_metrics::*; pub use lighthouse_metrics::*;
use types::{EthSpec, Slot}; use types::{EthSpec, Slot};

View File

@@ -1,6 +1,4 @@
extern crate proc_macro; use proc_macro::TokenStream;
use crate::proc_macro::TokenStream;
use quote::quote; use quote::quote;
use syn::{parse_macro_input, DeriveInput}; use syn::{parse_macro_input, DeriveInput};

View File

@@ -2,6 +2,7 @@
use crate::test_utils::*; use crate::test_utils::*;
use beacon_chain::test_utils::{BeaconChainHarness, EphemeralHarnessType}; use beacon_chain::test_utils::{BeaconChainHarness, EphemeralHarnessType};
use beacon_chain::types::*; use beacon_chain::types::*;
use lazy_static::lazy_static;
use swap_or_not_shuffle::shuffle_list; use swap_or_not_shuffle::shuffle_list;
pub const VALIDATOR_COUNT: usize = 16; pub const VALIDATOR_COUNT: usize = 16;

View File

@@ -6,6 +6,7 @@ use beacon_chain::types::{
ChainSpec, Domain, Epoch, EthSpec, Hash256, Keypair, MainnetEthSpec, MinimalEthSpec, ChainSpec, Domain, Epoch, EthSpec, Hash256, Keypair, MainnetEthSpec, MinimalEthSpec,
RelativeEpoch, Slot, Vector, RelativeEpoch, Slot, Vector,
}; };
use lazy_static::lazy_static;
use ssz::Encode; use ssz::Encode;
use std::ops::Mul; use std::ops::Mul;
use swap_or_not_shuffle::compute_shuffled_index; use swap_or_not_shuffle::compute_shuffled_index;

View File

@@ -9,8 +9,6 @@
) )
)] )]
#[macro_use]
extern crate lazy_static;
#[macro_use] #[macro_use]
pub mod test_utils; pub mod test_utils;

View File

@@ -1,5 +1,6 @@
//! Identifies each shard by an integer identifier. //! Identifies each shard by an integer identifier.
use crate::{AttestationData, ChainSpec, CommitteeIndex, Epoch, EthSpec, Slot}; use crate::{AttestationData, ChainSpec, CommitteeIndex, Epoch, EthSpec, Slot};
use lazy_static::lazy_static;
use safe_arith::{ArithError, SafeArith}; use safe_arith::{ArithError, SafeArith};
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use std::ops::{Deref, DerefMut}; use std::ops::{Deref, DerefMut};

View File

@@ -1,6 +1,7 @@
//! Identifies each sync committee subnet by an integer identifier. //! Identifies each sync committee subnet by an integer identifier.
use crate::consts::altair::SYNC_COMMITTEE_SUBNET_COUNT; use crate::consts::altair::SYNC_COMMITTEE_SUBNET_COUNT;
use crate::EthSpec; use crate::EthSpec;
use lazy_static::lazy_static;
use safe_arith::{ArithError, SafeArith}; use safe_arith::{ArithError, SafeArith};
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use ssz_types::typenum::Unsigned; use ssz_types::typenum::Unsigned;

View File

@@ -32,6 +32,7 @@ use clap_utils::{parse_optional, parse_required};
use environment::Environment; use environment::Environment;
use eth2::{types::BlockId, BeaconNodeHttpClient, SensitiveUrl, Timeouts}; use eth2::{types::BlockId, BeaconNodeHttpClient, SensitiveUrl, Timeouts};
use eth2_network_config::Eth2NetworkConfig; use eth2_network_config::Eth2NetworkConfig;
use log::info;
use std::path::PathBuf; use std::path::PathBuf;
use std::time::{Duration, Instant}; use std::time::{Duration, Instant};
use types::{EthSpec, FullPayload, SignedBeaconBlock}; use types::{EthSpec, FullPayload, SignedBeaconBlock};

View File

@@ -1,5 +1,3 @@
#[macro_use]
extern crate log;
mod block_root; mod block_root;
mod check_deposit_data; mod check_deposit_data;
mod generate_bootnode_enr; mod generate_bootnode_enr;

View File

@@ -1,6 +1,7 @@
use clap::ArgMatches; use clap::ArgMatches;
use clap_utils::parse_required; use clap_utils::parse_required;
use eth2_network_config::Eth2NetworkConfig; use eth2_network_config::Eth2NetworkConfig;
use log::info;
use serde::Serialize; use serde::Serialize;
use snap::raw::Decoder; use snap::raw::Decoder;
use ssz::Decode; use ssz::Decode;

View File

@@ -50,6 +50,7 @@ use clap_utils::{parse_optional, parse_required};
use environment::Environment; use environment::Environment;
use eth2::{types::StateId, BeaconNodeHttpClient, SensitiveUrl, Timeouts}; use eth2::{types::StateId, BeaconNodeHttpClient, SensitiveUrl, Timeouts};
use eth2_network_config::Eth2NetworkConfig; use eth2_network_config::Eth2NetworkConfig;
use log::info;
use ssz::Encode; use ssz::Encode;
use state_processing::state_advance::{complete_state_advance, partial_state_advance}; use state_processing::state_advance::{complete_state_advance, partial_state_advance};
use state_processing::AllCaches; use state_processing::AllCaches;

View File

@@ -4,6 +4,7 @@ use clap_utils::{parse_optional, parse_required};
use environment::Environment; use environment::Environment;
use eth2::{types::StateId, BeaconNodeHttpClient, SensitiveUrl, Timeouts}; use eth2::{types::StateId, BeaconNodeHttpClient, SensitiveUrl, Timeouts};
use eth2_network_config::Eth2NetworkConfig; use eth2_network_config::Eth2NetworkConfig;
use log::info;
use std::path::PathBuf; use std::path::PathBuf;
use std::time::{Duration, Instant}; use std::time::{Duration, Instant};
use types::{BeaconState, EthSpec}; use types::{BeaconState, EthSpec};

View File

@@ -72,6 +72,7 @@ use eth2::{
BeaconNodeHttpClient, SensitiveUrl, Timeouts, BeaconNodeHttpClient, SensitiveUrl, Timeouts,
}; };
use eth2_network_config::Eth2NetworkConfig; use eth2_network_config::Eth2NetworkConfig;
use log::{debug, info};
use ssz::Encode; use ssz::Encode;
use state_processing::state_advance::complete_state_advance; use state_processing::state_advance::complete_state_advance;
use state_processing::{ use state_processing::{

View File

@@ -10,9 +10,6 @@
//! simulation uses `println` to communicate some info. It might be nice if the nodes logged to //! simulation uses `println` to communicate some info. It might be nice if the nodes logged to
//! easy-to-find files and stdout only contained info from the simulation. //! easy-to-find files and stdout only contained info from the simulation.
//! //!
extern crate clap;
mod basic_sim; mod basic_sim;
mod checks; mod checks;
mod cli; mod cli;