Skip to content

Commit c573fda

Browse files
committed
Fix Clippy warning about derivable Default
1 parent fc758e8 commit c573fda

2 files changed

Lines changed: 4 additions & 14 deletions

File tree

src/encoding/integer/rle_v1.rs

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -234,19 +234,14 @@ impl<N: NInt, R: Read, S: EncodingSign> GenericRle<N> for RleV1Decoder<N, R, S>
234234
/// 1. `Empty`: The buffer is empty and there are no values to encode.
235235
/// 2. `Literal`: The encoder is in literal mode, with values saved in buffer.
236236
/// 3. `Run`: The encoder is in run mode, with a run value, delta, and length.
237-
#[derive(Debug, Clone, Eq, PartialEq)]
237+
#[derive(Debug, Clone, Eq, PartialEq, Default)]
238238
enum RleV1EncodingState<N: NInt> {
239+
#[default]
239240
Empty,
240241
Literal,
241242
Run { value: N, delta: i8, length: usize },
242243
}
243244

244-
impl<N: NInt> Default for RleV1EncodingState<N> {
245-
fn default() -> Self {
246-
Self::Empty
247-
}
248-
}
249-
250245
/// `RleV1Encoder` is responsible for encoding a stream of integers using the Run Length Encoding (RLE) version 1 format.
251246
pub struct RleV1Encoder<N: NInt, S: EncodingSign> {
252247
writer: BytesMut,

src/encoding/integer/rle_v2/mod.rs

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -238,8 +238,9 @@ fn delta_encoding_check<N: NInt>(literals: &[N]) -> DeltaEncodingCheckResult<N>
238238
}
239239

240240
/// Runs are guaranteed to have length > 1.
241-
#[derive(Debug, Clone, Eq, PartialEq)]
241+
#[derive(Debug, Clone, Eq, PartialEq, Default)]
242242
enum RleV2EncodingState<N: NInt> {
243+
#[default]
243244
/// When buffer is empty and no values to encode.
244245
Empty,
245246
/// Special state for first value as we determine after the first
@@ -251,12 +252,6 @@ enum RleV2EncodingState<N: NInt> {
251252
VariableRun { literals: Vec<N> },
252253
}
253254

254-
impl<N: NInt> Default for RleV2EncodingState<N> {
255-
fn default() -> Self {
256-
Self::Empty
257-
}
258-
}
259-
260255
pub struct RleV2Encoder<N: NInt, S: EncodingSign> {
261256
/// Stores the run length encoded sequences.
262257
data: BytesMut,

0 commit comments

Comments
 (0)