Use full path in macros to to eliminate uses

This commit is contained in:
Carl Dong 2018-08-21 01:00:10 -07:00
parent e5b5cbfadb
commit 95303a1d28
3 changed files with 5 additions and 6 deletions

View File

@ -25,7 +25,7 @@ use util::Error::{SpvBadTarget, SpvBadProofOfWork};
use util::hash::Sha256dHash; use util::hash::Sha256dHash;
use util::uint::Uint256; use util::uint::Uint256;
use network::encodable::VarInt; use network::encodable::VarInt;
use network::serialize::{self, BitcoinHash}; use network::serialize::BitcoinHash;
use network::constants::Network; use network::constants::Network;
use blockdata::transaction::Transaction; use blockdata::transaction::Transaction;
use blockdata::constants::max_target; use blockdata::constants::max_target;

View File

@ -16,7 +16,7 @@ macro_rules! impl_consensus_encoding {
($thing:ident, $($field:ident),+) => ( ($thing:ident, $($field:ident),+) => (
impl<S: ::network::serialize::SimpleEncoder> ::network::encodable::ConsensusEncodable<S> for $thing { impl<S: ::network::serialize::SimpleEncoder> ::network::encodable::ConsensusEncodable<S> for $thing {
#[inline] #[inline]
fn consensus_encode(&self, s: &mut S) -> Result<(), serialize::Error> { fn consensus_encode(&self, s: &mut S) -> Result<(), ::network::serialize::Error> {
$( self.$field.consensus_encode(s)?; )+ $( self.$field.consensus_encode(s)?; )+
Ok(()) Ok(())
} }
@ -24,7 +24,7 @@ macro_rules! impl_consensus_encoding {
impl<D: ::network::serialize::SimpleDecoder> ::network::encodable::ConsensusDecodable<D> for $thing { impl<D: ::network::serialize::SimpleDecoder> ::network::encodable::ConsensusDecodable<D> for $thing {
#[inline] #[inline]
fn consensus_decode(d: &mut D) -> Result<$thing, serialize::Error> { fn consensus_decode(d: &mut D) -> Result<$thing, ::network::serialize::Error> {
use network::encodable::ConsensusDecodable; use network::encodable::ConsensusDecodable;
Ok($thing { Ok($thing {
$( $field: ConsensusDecodable::consensus_decode(d)?, )+ $( $field: ConsensusDecodable::consensus_decode(d)?, )+
@ -38,7 +38,7 @@ macro_rules! impl_newtype_consensus_encoding {
($thing:ident) => ( ($thing:ident) => (
impl<S: ::network::serialize::SimpleEncoder> ::network::encodable::ConsensusEncodable<S> for $thing { impl<S: ::network::serialize::SimpleEncoder> ::network::encodable::ConsensusEncodable<S> for $thing {
#[inline] #[inline]
fn consensus_encode(&self, s: &mut S) -> Result<(), serialize::Error> { fn consensus_encode(&self, s: &mut S) -> Result<(), ::network::serialize::Error> {
let &$thing(ref data) = self; let &$thing(ref data) = self;
data.consensus_encode(s) data.consensus_encode(s)
} }
@ -46,7 +46,7 @@ macro_rules! impl_newtype_consensus_encoding {
impl<D: ::network::serialize::SimpleDecoder> ::network::encodable::ConsensusDecodable<D> for $thing { impl<D: ::network::serialize::SimpleDecoder> ::network::encodable::ConsensusDecodable<D> for $thing {
#[inline] #[inline]
fn consensus_decode(d: &mut D) -> Result<$thing, serialize::Error> { fn consensus_decode(d: &mut D) -> Result<$thing, ::network::serialize::Error> {
Ok($thing(ConsensusDecodable::consensus_decode(d)?)) Ok($thing(ConsensusDecodable::consensus_decode(d)?))
} }
} }

View File

@ -20,7 +20,6 @@
use network::constants; use network::constants;
use network::address::Address; use network::address::Address;
use network::serialize;
use network::socket::Socket; use network::socket::Socket;
use util; use util;