Skip to content

Commit

Permalink
Allow no is_empty method for VarInt
Browse files Browse the repository at this point in the history
Clippy emits:

  warning: struct `VarInt` has a public `len` method, but no `is_empty`
  method

However, `VarInt` has no concept of 'is empty' so add a compiler
directive to allow the lint.
  • Loading branch information
tcharding committed May 25, 2022
1 parent 841f1f5 commit 51c60b8
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions src/consensus/encode.rs
Original file line number Diff line number Diff line change
Expand Up @@ -359,6 +359,7 @@ impl_int_encodable!(i16, read_i16, emit_i16);
impl_int_encodable!(i32, read_i32, emit_i32);
impl_int_encodable!(i64, read_i64, emit_i64);

#[allow(clippy::len_without_is_empty)] // VarInt has on concept of 'is_empty'.
impl VarInt {
/// Gets the length of this VarInt when encoded.
/// Returns 1 for 0..=0xFC, 3 for 0xFD..=(2^16-1), 5 for 0x10000..=(2^32-1),
Expand Down

0 comments on commit 51c60b8

Please sign in to comment.