Rust code style - nervosnetwork/muta GitHub Wiki
Mod
Classify modules.
// bad
use crate::errors::ConsensusError;
use core_crypto::{Crypto, CryptoTransform};
use core_merkle::Merkle;
use core_runtime::{Executor, TransactionPool};
use core_storage::storage::Storage;
use core_types::{Address, Block, BlockHeader, Hash};
use futures::future::{ok, Future};
use futures_locks::RwLock;
use std::error::Error;
use std::marker::PhantomData;
use std::sync::Arc;
use std::time::{Duration, Instant, SystemTime, UNIX_EPOCH};
use tokio::timer::Delay;
// best
// 1. from std
use std::error::Error;
use std::marker::PhantomData;
use std::sync::Arc;
use std::time::{Duration, Instant, SystemTime, UNIX_EPOCH};
// 2. from crates.io
use futures::future::{ok, Future};
use futures_locks::RwLock;
use tokio::timer::Delay;
// 3. from workspace
use core_crypto::{Crypto, CryptoTransform};
use core_merkle::Merkle;
use core_runtime::{Executor, TransactionPool};
use core_storage::storage::Storage;
use core_types::{Address, Block, BlockHeader, Hash};
// 4. from project
use crate::errors::ConsensusError;
super
.
Do not use // bad
use supper::errors::ConsensusError;
// best
use crate::errors::ConsensusError;
TODO