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:
Tobin Harding 2022-01-24 11:55:26 +11:00
parent 702e8bf82d
commit d6462bae7b
1 changed files with 5 additions and 6 deletions

View File

@ -146,12 +146,11 @@ pub enum AddrV2 {
impl Encodable for AddrV2 {
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> {
let len =
network.consensus_encode(&mut e)? +
VarInt(bytes.len() as u64).consensus_encode(&mut e)? +
bytes.len();
e.emit_slice(bytes)?;
Ok(len)
let len = network.consensus_encode(&mut e)?
+ VarInt(bytes.len() as u64).consensus_encode(&mut e)?
+ bytes.len();
e.emit_slice(bytes)?;
Ok(len)
}
Ok(match *self {
AddrV2::Ipv4(ref addr) => encode_addr(e, 1, &addr.octets())?,