From 7473b0749aa682b3cb9dea2d54cfa0612ba94c96 Mon Sep 17 00:00:00 2001 From: Michael Hoffmann Date: Tue, 28 Jan 2025 10:25:42 +0100 Subject: [PATCH 1/2] Fix CS --- sentry-actix/src/lib.rs | 4 ++-- sentry-core/src/client.rs | 5 +---- sentry-core/src/hub_impl.rs | 2 +- 3 files changed, 4 insertions(+), 7 deletions(-) diff --git a/sentry-actix/src/lib.rs b/sentry-actix/src/lib.rs index 3232d140f..faf332419 100644 --- a/sentry-actix/src/lib.rs +++ b/sentry-actix/src/lib.rs @@ -225,7 +225,7 @@ where inner.hub.clone().unwrap_or_else(Hub::main), )); let client = hub.client(); - let track_sessions = client.as_ref().map_or(false, |client| { + let track_sessions = client.as_ref().is_some_and(|client| { let options = client.options(); options.auto_session_tracking && options.session_mode == sentry_core::SessionMode::Request @@ -235,7 +235,7 @@ where } let with_pii = client .as_ref() - .map_or(false, |client| client.options().send_default_pii); + .is_some_and(|client| client.options().send_default_pii); let sentry_req = sentry_request_from_http(&req, with_pii); let name = transaction_name_from_http(&req); diff --git a/sentry-core/src/client.rs b/sentry-core/src/client.rs index 56bd0d22f..7a6f6d65e 100644 --- a/sentry-core/src/client.rs +++ b/sentry-core/src/client.rs @@ -189,10 +189,7 @@ impl Client { } if let Some(scope) = scope { - event = match scope.apply_to_event(event) { - Some(event) => event, - None => return None, - }; + event = scope.apply_to_event(event)?; } for (_, integration) in self.integrations.iter() { diff --git a/sentry-core/src/hub_impl.rs b/sentry-core/src/hub_impl.rs index 59c91bf97..a459e0e1d 100644 --- a/sentry-core/src/hub_impl.rs +++ b/sentry-core/src/hub_impl.rs @@ -94,7 +94,7 @@ impl HubImpl { .top() .client .as_ref() - .map_or(false, |c| c.is_enabled()) + .is_some_and(|c| c.is_enabled()) } } From 29a57d133aab92a668d70b1e5ab5ec558c7bab37 Mon Sep 17 00:00:00 2001 From: Michael Hoffmann Date: Tue, 28 Jan 2025 10:27:12 +0100 Subject: [PATCH 2/2] Whatever --- sentry-core/src/hub_impl.rs | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/sentry-core/src/hub_impl.rs b/sentry-core/src/hub_impl.rs index a459e0e1d..42d1fa6b3 100644 --- a/sentry-core/src/hub_impl.rs +++ b/sentry-core/src/hub_impl.rs @@ -90,11 +90,7 @@ impl HubImpl { Ok(guard) => guard, }; - guard - .top() - .client - .as_ref() - .is_some_and(|c| c.is_enabled()) + guard.top().client.as_ref().is_some_and(|c| c.is_enabled()) } }