fmt does not work with cfg_if (#5829)
This commit is contained in:
1
Cargo.lock
generated
1
Cargo.lock
generated
@ -3686,7 +3686,6 @@ dependencies = [
|
|||||||
"bincode 1.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
"bincode 1.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"bs58 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
"bs58 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
"byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"cfg-if 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"chrono 0.4.9 (registry+https://github.com/rust-lang/crates.io-index)",
|
"chrono 0.4.9 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"generic-array 0.13.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
"generic-array 0.13.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"hex 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
"hex 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
@ -36,7 +36,6 @@ assert_matches = { version = "1.3.0", optional = true }
|
|||||||
bincode = "1.1.4"
|
bincode = "1.1.4"
|
||||||
bs58 = "0.2.5"
|
bs58 = "0.2.5"
|
||||||
byteorder = { version = "1.3.2", optional = true }
|
byteorder = { version = "1.3.2", optional = true }
|
||||||
cfg-if = "0.1.9"
|
|
||||||
chrono = { version = "0.4.9", features = ["serde"], optional = true }
|
chrono = { version = "0.4.9", features = ["serde"], optional = true }
|
||||||
generic-array = { version = "0.13.2", default-features = false, features = ["serde", "more_lengths"], optional = true }
|
generic-array = { version = "0.13.2", default-features = false, features = ["serde", "more_lengths"], optional = true }
|
||||||
hex = "0.3.2"
|
hex = "0.3.2"
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
use crate::{pubkey::Pubkey, clock::Epoch};
|
use crate::{clock::Epoch, pubkey::Pubkey};
|
||||||
use std::{cmp, fmt};
|
use std::{cmp, fmt};
|
||||||
|
|
||||||
/// An Account with data that is stored on chain
|
/// An Account with data that is stored on chain
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
use crate::message::Message;
|
|
||||||
use crate::clock::{DEFAULT_TICKS_PER_SECOND, DEFAULT_TICKS_PER_SLOT};
|
use crate::clock::{DEFAULT_TICKS_PER_SECOND, DEFAULT_TICKS_PER_SLOT};
|
||||||
|
use crate::message::Message;
|
||||||
use log::*;
|
use log::*;
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize, PartialEq, Eq, Clone, Debug)]
|
#[derive(Serialize, Deserialize, PartialEq, Eq, Clone, Debug)]
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
//! The `genesis_block` module is a library for generating the chain's genesis block.
|
//! The `genesis_block` module is a library for generating the chain's genesis block.
|
||||||
|
|
||||||
use crate::account::Account;
|
use crate::account::Account;
|
||||||
|
use crate::clock::{DEFAULT_SLOTS_PER_EPOCH, DEFAULT_SLOTS_PER_SEGMENT, DEFAULT_TICKS_PER_SLOT};
|
||||||
use crate::fee_calculator::FeeCalculator;
|
use crate::fee_calculator::FeeCalculator;
|
||||||
use crate::hash::{hash, Hash};
|
use crate::hash::{hash, Hash};
|
||||||
use crate::inflation::Inflation;
|
use crate::inflation::Inflation;
|
||||||
@ -9,7 +10,6 @@ use crate::pubkey::Pubkey;
|
|||||||
use crate::rent::Rent;
|
use crate::rent::Rent;
|
||||||
use crate::signature::{Keypair, KeypairUtil};
|
use crate::signature::{Keypair, KeypairUtil};
|
||||||
use crate::system_program::{self, solana_system_program};
|
use crate::system_program::{self, solana_system_program};
|
||||||
use crate::clock::{DEFAULT_SLOTS_PER_EPOCH, DEFAULT_SLOTS_PER_SEGMENT, DEFAULT_TICKS_PER_SLOT};
|
|
||||||
use bincode::{deserialize, serialize};
|
use bincode::{deserialize, serialize};
|
||||||
use memmap::Mmap;
|
use memmap::Mmap;
|
||||||
use std::fs::{File, OpenOptions};
|
use std::fs::{File, OpenOptions};
|
||||||
|
@ -1,49 +1,67 @@
|
|||||||
#[macro_use]
|
|
||||||
extern crate cfg_if;
|
|
||||||
|
|
||||||
pub mod clock;
|
pub mod clock;
|
||||||
pub mod pubkey;
|
pub mod pubkey;
|
||||||
|
|
||||||
// On-chain program modules
|
// On-chain program modules
|
||||||
cfg_if! {
|
#[cfg(feature = "program")]
|
||||||
if #[cfg(feature = "program")] {
|
pub mod entrypoint;
|
||||||
pub mod entrypoint;
|
#[cfg(feature = "program")]
|
||||||
pub mod log;
|
pub mod log;
|
||||||
pub mod program_test;
|
#[cfg(feature = "program")]
|
||||||
}
|
pub mod program_test;
|
||||||
}
|
|
||||||
|
|
||||||
// Kitchen sink modules
|
// Kitchen sink modules
|
||||||
cfg_if! {
|
#[cfg(feature = "kitchen_sink")]
|
||||||
if #[cfg(feature = "kitchen_sink")] {
|
pub mod account;
|
||||||
pub mod account;
|
#[cfg(feature = "kitchen_sink")]
|
||||||
pub mod account_utils;
|
pub mod account_utils;
|
||||||
pub mod bpf_loader;
|
#[cfg(feature = "kitchen_sink")]
|
||||||
pub mod client;
|
pub mod bpf_loader;
|
||||||
pub mod fee_calculator;
|
#[cfg(feature = "kitchen_sink")]
|
||||||
pub mod genesis_block;
|
pub mod client;
|
||||||
pub mod hash;
|
#[cfg(feature = "kitchen_sink")]
|
||||||
pub mod inflation;
|
pub mod fee_calculator;
|
||||||
pub mod instruction;
|
#[cfg(feature = "kitchen_sink")]
|
||||||
pub mod instruction_processor_utils;
|
pub mod genesis_block;
|
||||||
pub mod loader_instruction;
|
#[cfg(feature = "kitchen_sink")]
|
||||||
pub mod message;
|
pub mod hash;
|
||||||
pub mod native_loader;
|
#[cfg(feature = "kitchen_sink")]
|
||||||
pub mod packet;
|
pub mod inflation;
|
||||||
pub mod poh_config;
|
#[cfg(feature = "kitchen_sink")]
|
||||||
pub mod rent;
|
pub mod instruction;
|
||||||
pub mod rpc_port;
|
#[cfg(feature = "kitchen_sink")]
|
||||||
pub mod short_vec;
|
pub mod instruction_processor_utils;
|
||||||
pub mod signature;
|
#[cfg(feature = "kitchen_sink")]
|
||||||
pub mod system_instruction;
|
pub mod loader_instruction;
|
||||||
pub mod system_program;
|
#[cfg(feature = "kitchen_sink")]
|
||||||
pub mod system_transaction;
|
pub mod message;
|
||||||
pub mod sysvar;
|
#[cfg(feature = "kitchen_sink")]
|
||||||
pub mod timing;
|
pub mod native_loader;
|
||||||
pub mod transaction;
|
#[cfg(feature = "kitchen_sink")]
|
||||||
pub mod transport;
|
pub mod packet;
|
||||||
}
|
#[cfg(feature = "kitchen_sink")]
|
||||||
}
|
pub mod poh_config;
|
||||||
|
#[cfg(feature = "kitchen_sink")]
|
||||||
|
pub mod rent;
|
||||||
|
#[cfg(feature = "kitchen_sink")]
|
||||||
|
pub mod rpc_port;
|
||||||
|
#[cfg(feature = "kitchen_sink")]
|
||||||
|
pub mod short_vec;
|
||||||
|
#[cfg(feature = "kitchen_sink")]
|
||||||
|
pub mod signature;
|
||||||
|
#[cfg(feature = "kitchen_sink")]
|
||||||
|
pub mod system_instruction;
|
||||||
|
#[cfg(feature = "kitchen_sink")]
|
||||||
|
pub mod system_program;
|
||||||
|
#[cfg(feature = "kitchen_sink")]
|
||||||
|
pub mod system_transaction;
|
||||||
|
#[cfg(feature = "kitchen_sink")]
|
||||||
|
pub mod sysvar;
|
||||||
|
#[cfg(feature = "kitchen_sink")]
|
||||||
|
pub mod timing;
|
||||||
|
#[cfg(feature = "kitchen_sink")]
|
||||||
|
pub mod transaction;
|
||||||
|
#[cfg(feature = "kitchen_sink")]
|
||||||
|
pub mod transport;
|
||||||
|
|
||||||
#[macro_use]
|
#[macro_use]
|
||||||
extern crate serde_derive;
|
extern crate serde_derive;
|
||||||
|
@ -56,8 +56,8 @@ pub fn create_account(
|
|||||||
}
|
}
|
||||||
|
|
||||||
use crate::account::KeyedAccount;
|
use crate::account::KeyedAccount;
|
||||||
use crate::instruction::InstructionError;
|
|
||||||
use crate::clock::Segment;
|
use crate::clock::Segment;
|
||||||
|
use crate::instruction::InstructionError;
|
||||||
|
|
||||||
pub fn from_keyed_account(account: &KeyedAccount) -> Result<Clock, InstructionError> {
|
pub fn from_keyed_account(account: &KeyedAccount) -> Result<Clock, InstructionError> {
|
||||||
if !check_id(account.unsigned_key()) {
|
if !check_id(account.unsigned_key()) {
|
||||||
|
Reference in New Issue
Block a user