fmt does not work with cfg_if (#5829)

This commit is contained in:
Jack May 2019-09-06 15:33:58 -07:00 committed by GitHub
parent 4c4b7d39b8
commit d3052d094c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 62 additions and 46 deletions

1
Cargo.lock generated
View File

@ -3686,7 +3686,6 @@ dependencies = [
"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)",
"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)",
"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)",

View File

@ -36,7 +36,6 @@ assert_matches = { version = "1.3.0", optional = true }
bincode = "1.1.4"
bs58 = "0.2.5"
byteorder = { version = "1.3.2", optional = true }
cfg-if = "0.1.9"
chrono = { version = "0.4.9", features = ["serde"], optional = true }
generic-array = { version = "0.13.2", default-features = false, features = ["serde", "more_lengths"], optional = true }
hex = "0.3.2"

View File

@ -1,4 +1,4 @@
use crate::{pubkey::Pubkey, clock::Epoch};
use crate::{clock::Epoch, pubkey::Pubkey};
use std::{cmp, fmt};
/// An Account with data that is stored on chain

View File

@ -1,5 +1,5 @@
use crate::message::Message;
use crate::clock::{DEFAULT_TICKS_PER_SECOND, DEFAULT_TICKS_PER_SLOT};
use crate::message::Message;
use log::*;
#[derive(Serialize, Deserialize, PartialEq, Eq, Clone, Debug)]

View File

@ -1,6 +1,7 @@
//! The `genesis_block` module is a library for generating the chain's genesis block.
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::hash::{hash, Hash};
use crate::inflation::Inflation;
@ -9,7 +10,6 @@ use crate::pubkey::Pubkey;
use crate::rent::Rent;
use crate::signature::{Keypair, KeypairUtil};
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 memmap::Mmap;
use std::fs::{File, OpenOptions};

View File

@ -1,49 +1,67 @@
#[macro_use]
extern crate cfg_if;
pub mod clock;
pub mod pubkey;
// On-chain program modules
cfg_if! {
if #[cfg(feature = "program")] {
pub mod entrypoint;
pub mod log;
pub mod program_test;
}
}
#[cfg(feature = "program")]
pub mod entrypoint;
#[cfg(feature = "program")]
pub mod log;
#[cfg(feature = "program")]
pub mod program_test;
// Kitchen sink modules
cfg_if! {
if #[cfg(feature = "kitchen_sink")] {
pub mod account;
pub mod account_utils;
pub mod bpf_loader;
pub mod client;
pub mod fee_calculator;
pub mod genesis_block;
pub mod hash;
pub mod inflation;
pub mod instruction;
pub mod instruction_processor_utils;
pub mod loader_instruction;
pub mod message;
pub mod native_loader;
pub mod packet;
pub mod poh_config;
pub mod rent;
pub mod rpc_port;
pub mod short_vec;
pub mod signature;
pub mod system_instruction;
pub mod system_program;
pub mod system_transaction;
pub mod sysvar;
pub mod timing;
pub mod transaction;
pub mod transport;
}
}
#[cfg(feature = "kitchen_sink")]
pub mod account;
#[cfg(feature = "kitchen_sink")]
pub mod account_utils;
#[cfg(feature = "kitchen_sink")]
pub mod bpf_loader;
#[cfg(feature = "kitchen_sink")]
pub mod client;
#[cfg(feature = "kitchen_sink")]
pub mod fee_calculator;
#[cfg(feature = "kitchen_sink")]
pub mod genesis_block;
#[cfg(feature = "kitchen_sink")]
pub mod hash;
#[cfg(feature = "kitchen_sink")]
pub mod inflation;
#[cfg(feature = "kitchen_sink")]
pub mod instruction;
#[cfg(feature = "kitchen_sink")]
pub mod instruction_processor_utils;
#[cfg(feature = "kitchen_sink")]
pub mod loader_instruction;
#[cfg(feature = "kitchen_sink")]
pub mod message;
#[cfg(feature = "kitchen_sink")]
pub mod native_loader;
#[cfg(feature = "kitchen_sink")]
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]
extern crate serde_derive;

View File

@ -56,8 +56,8 @@ pub fn create_account(
}
use crate::account::KeyedAccount;
use crate::instruction::InstructionError;
use crate::clock::Segment;
use crate::instruction::InstructionError;
pub fn from_keyed_account(account: &KeyedAccount) -> Result<Clock, InstructionError> {
if !check_id(account.unsigned_key()) {