diff --git a/zebra-chain/src/transaction/serialize.rs b/zebra-chain/src/transaction/serialize.rs index 9ff3ce8f..4d41de96 100644 --- a/zebra-chain/src/transaction/serialize.rs +++ b/zebra-chain/src/transaction/serialize.rs @@ -70,7 +70,7 @@ fn parse_coinbase_height(mut data: Vec) -> Result<(BlockHeight, Vec), Se // while remaining below the maximum `BlockHeight` of 500_000_000 forced by `LockTime`. // While it's unlikely this code will ever process a block height that high, this means // we don't need to maintain a cascade of different invariants for allowable `BlockHeight`s. - (Some(0x04), _) if &data[..] == &GENESIS_COINBASE_DATA[..] => Ok((BlockHeight(0), data)), + (Some(0x04), _) if data[..] == GENESIS_COINBASE_DATA[..] => Ok((BlockHeight(0), data)), // As noted above, this is included for completeness. (Some(0x04), len) if len >= 5 => { let h = data[1] as u32 @@ -100,9 +100,9 @@ fn coinbase_height_len(height: BlockHeight) -> usize { 2 } else if let _h @ 256..=65535 = height.0 { 3 - } else if let _h @ 65536..=16777215 = height.0 { + } else if let _h @ 65536..=16_777_215 = height.0 { 4 - } else if let _h @ 16777216..=499_999_999 = height.0 { + } else if let _h @ 16_777_216..=499_999_999 = height.0 { 5 } else { panic!("Invalid coinbase height"); @@ -122,12 +122,12 @@ fn write_coinbase_height(height: BlockHeight, mut w: W) -> Result< } else if let h @ 256..=65535 = height.0 { w.write_u8(0x02)?; w.write_u16::(h as u16)?; - } else if let h @ 65536..=16777215 = height.0 { + } else if let h @ 65536..=16_777_215 = height.0 { w.write_u8(0x03)?; w.write_u8(h as u8)?; w.write_u8((h >> 8) as u8)?; w.write_u8((h >> 16) as u8)?; - } else if let h @ 16777216..=499_999_999 = height.0 { + } else if let h @ 16_777_216..=499_999_999 = height.0 { w.write_u8(0x04)?; w.write_u32::(h)?; } else { diff --git a/zebrad/src/lib.rs b/zebrad/src/lib.rs index b0228e44..f43297a4 100644 --- a/zebrad/src/lib.rs +++ b/zebrad/src/lib.rs @@ -14,6 +14,9 @@ //#![deny(warnings, missing_docs, trivial_casts, unused_qualifications)] #![forbid(unsafe_code)] +// Tracing causes false positives on this lint: +// https://github.com/tokio-rs/tracing/issues/553 +#![allow(clippy::cognitive_complexity)] #[macro_use] extern crate tracing;