Refactor usage of +
As we do for logical operators; put the `+` operator at the start of the line to make it more obvious and assist devs reading the code.
This commit is contained in:
parent
702e8bf82d
commit
d6462bae7b
|
@ -146,12 +146,11 @@ pub enum AddrV2 {
|
||||||
impl Encodable for AddrV2 {
|
impl Encodable for AddrV2 {
|
||||||
fn consensus_encode<W: io::Write>(&self, e: W) -> Result<usize, io::Error> {
|
fn consensus_encode<W: io::Write>(&self, e: W) -> Result<usize, io::Error> {
|
||||||
fn encode_addr<W: io::Write>(mut e: W, network: u8, bytes: &[u8]) -> Result<usize, io::Error> {
|
fn encode_addr<W: io::Write>(mut e: W, network: u8, bytes: &[u8]) -> Result<usize, io::Error> {
|
||||||
let len =
|
let len = network.consensus_encode(&mut e)?
|
||||||
network.consensus_encode(&mut e)? +
|
+ VarInt(bytes.len() as u64).consensus_encode(&mut e)?
|
||||||
VarInt(bytes.len() as u64).consensus_encode(&mut e)? +
|
+ bytes.len();
|
||||||
bytes.len();
|
e.emit_slice(bytes)?;
|
||||||
e.emit_slice(bytes)?;
|
Ok(len)
|
||||||
Ok(len)
|
|
||||||
}
|
}
|
||||||
Ok(match *self {
|
Ok(match *self {
|
||||||
AddrV2::Ipv4(ref addr) => encode_addr(e, 1, &addr.octets())?,
|
AddrV2::Ipv4(ref addr) => encode_addr(e, 1, &addr.octets())?,
|
||||||
|
|
Loading…
Reference in New Issue