Skip to content

Commit d8ebd76

Browse files
committed
style: clippy::large_enum_variant and clippy::derivable_impls
1 parent 1d1f4b8 commit d8ebd76

File tree

3 files changed

+6
-8
lines changed

3 files changed

+6
-8
lines changed

datadog-profiling-ffi/src/profiles/datatypes.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@ use anyhow::Context;
66
use datadog_profiling::api;
77
use datadog_profiling::api::ManagedStringId;
88
use datadog_profiling::internal;
9+
use datadog_profiling::serializer::UploadCompression;
910
use ddcommon_ffi::slice::{AsBytes, ByteSlice, CharSlice, Slice};
1011
use ddcommon_ffi::{wrap_with_ffi_result, Error, Handle, Timespec, ToInner};
1112
use function_name::named;
1213
use std::num::NonZeroI64;
1314
use std::str::Utf8Error;
1415
use std::time::SystemTime;
15-
use datadog_profiling::serializer::UploadCompression;
1616

1717
/// Represents a profile. Do not access its member for any reason, only use
1818
/// the C API functions on this struct.

datadog-profiling/src/serializer/compressed_streaming_encoder.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ use lz4_flex::frame::FrameEncoder;
77
use prost::encoding::{encode_key, encode_varint, encoded_len_varint, key_len, WireType};
88
use std::io::{self, Write};
99

10+
// None is not really for prod, so the fact it takes 0 space, creating a large
11+
// discrepancy in size between the enum variants, is irrelevant.
12+
#[allow(clippy::large_enum_variant)]
1013
enum Compressor {
1114
None,
1215
Lz4 { zipper: FrameEncoder<Vec<u8>> },

datadog-profiling/src/serializer/mod.rs

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,12 @@ mod compressed_streaming_encoder;
66
pub use compressed_streaming_encoder::*;
77

88
#[repr(C)]
9-
#[derive(Debug)]
9+
#[derive(Debug, Default)]
1010
pub enum UploadCompression {
1111
Off,
1212
/// On is the default, with the exact compression algorithm being
1313
/// unspecified, and free to change. For example, we're testing zstd.
14+
#[default]
1415
On,
1516
Lz4,
1617
}
17-
18-
impl Default for UploadCompression {
19-
fn default() -> Self {
20-
UploadCompression::On
21-
}
22-
}

0 commit comments

Comments
 (0)