From bfa29e3bc89b720cb43176051f30d2228c8f46e7 Mon Sep 17 00:00:00 2001 From: Daniel Szoke Date: Tue, 11 Nov 2025 10:02:05 +0100 Subject: [PATCH] ref: Fix new Clippy lints Resolves #934 Resolves [RUST-124](https://linear.app/getsentry/issue/RUST-124/fix-lint-ci-job-failures) --- sentry-types/src/protocol/attachment.rs | 9 ++------- sentry-types/src/protocol/session.rs | 8 ++------ 2 files changed, 4 insertions(+), 13 deletions(-) diff --git a/sentry-types/src/protocol/attachment.rs b/sentry-types/src/protocol/attachment.rs index e23a64784..5ad1f00da 100644 --- a/sentry-types/src/protocol/attachment.rs +++ b/sentry-types/src/protocol/attachment.rs @@ -3,10 +3,11 @@ use std::fmt; use serde::Deserialize; /// The different types an attachment can have. -#[derive(Debug, Clone, Eq, PartialEq, Deserialize)] +#[derive(Debug, Clone, Eq, PartialEq, Deserialize, Default)] pub enum AttachmentType { #[serde(rename = "event.attachment")] /// (default) A standard attachment without special meaning. + #[default] Attachment, /// A minidump file that creates an error event and is symbolicated. The /// file should start with the `MDMP` magic bytes. @@ -28,12 +29,6 @@ pub enum AttachmentType { Custom(String), } -impl Default for AttachmentType { - fn default() -> Self { - Self::Attachment - } -} - impl AttachmentType { /// Gets the string value Sentry expects for the attachment type. pub fn as_str(&self) -> &str { diff --git a/sentry-types/src/protocol/session.rs b/sentry-types/src/protocol/session.rs index 43ea9fc3e..948efd301 100644 --- a/sentry-types/src/protocol/session.rs +++ b/sentry-types/src/protocol/session.rs @@ -13,10 +13,12 @@ use crate::utils::{ts_rfc3339, ts_rfc3339_opt}; /// The Status of a Release Health Session. #[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd, Deserialize, Serialize)] #[serde(rename_all = "snake_case")] +#[derive(Default)] pub enum SessionStatus { /// The session is healthy. /// /// This does not necessarily indicate that the session is still active. + #[default] Ok, /// The session terminated normally. Exited, @@ -26,12 +28,6 @@ pub enum SessionStatus { Abnormal, } -impl Default for SessionStatus { - fn default() -> Self { - Self::Ok - } -} - /// An error used when parsing `SessionStatus`. #[derive(Debug, Error)] #[error("invalid session status")]