From ec791fed9c2260688f25ea6a6d53ab913927e9a5 Mon Sep 17 00:00:00 2001
From: Oleksandr <1931331+olksdr@users.noreply.github.com>
Date: Mon, 25 Mar 2024 07:23:29 +0100
Subject: [PATCH] chore(beta): Compile and test Relay with current beta (#3312)
Make sure that Relay compiles with beta, and all the lint warnings and
errors are addressed.
This mostly done with `cargo fix` and plus some small manual deletions.
There is no functional changes in this PR.
---
relay-base-schema/src/data_category.rs | 1 -
relay-cardinality/src/redis/cache.rs | 2 -
relay-cardinality/src/redis/limiter.rs | 2 -
relay-config/src/byte_size.rs | 1 -
relay-config/src/config.rs | 1 -
relay-event-normalization/src/event.rs | 14 ++----
.../src/normalize/mod.rs | 2 +-
.../src/normalize/request.rs | 2 +-
.../normalize/span/description/sql/parser.rs | 4 +-
.../src/normalize/span/exclusive_time.rs | 5 +-
.../src/normalize/span/tag_extraction.rs | 4 +-
.../src/normalize/user_agent.rs | 2 +-
relay-event-normalization/src/schema.rs | 4 +-
.../src/transactions/processor.rs | 2 +-
.../src/transactions/rules.rs | 2 -
relay-event-normalization/src/trimming.rs | 8 +---
.../src/protocol/contexts/device.rs | 1 -
.../src/protocol/contexts/response.rs | 2 -
relay-event-schema/src/protocol/request.rs | 2 -
relay-event-schema/src/protocol/types.rs | 1 -
relay-filter/src/common.rs | 1 -
relay-filter/src/generic.rs | 5 +-
relay-filter/src/legacy_browsers.rs | 2 -
relay-filter/src/releases.rs | 2 +-
relay-metrics/src/aggregator.rs | 1 -
relay-metrics/src/aggregatorservice.rs | 3 +-
relay-metrics/src/view.rs | 1 -
relay-monitors/src/lib.rs | 2 +-
relay-pii/src/attachments.rs | 3 +-
relay-pii/src/builtin.rs | 1 -
relay-pii/src/minidumps.rs | 1 -
relay-pii/src/processor.rs | 8 ++--
relay-pii/src/selector.rs | 4 +-
relay-profiling/src/android.rs | 18 ++++---
.../src/extract_from_transaction.rs | 1 -
relay-profiling/src/sample.rs | 8 ++--
relay-quotas/src/redis.rs | 1 -
relay-sampling/src/evaluation.rs | 12 ++---
.../src/metrics_extraction/sessions/mod.rs | 2 +-
relay-server/src/services/outcome.rs | 4 +-
relay-server/src/services/processor.rs | 11 ++---
.../services/processor/dynamic_sampling.rs | 2 +-
relay-server/src/services/processor/event.rs | 2 -
.../src/services/processor/profile.rs | 8 ++--
relay-server/src/services/processor/replay.rs | 1 -
relay-server/src/services/project.rs | 2 +-
relay-server/src/services/project_cache.rs | 2 -
relay-server/src/services/project_local.rs | 6 +--
relay-server/src/services/spooler/mod.rs | 1 -
relay-server/src/services/store.rs | 47 -------------------
relay-server/src/utils/dynamic_sampling.rs | 5 +-
relay-server/src/utils/metrics_rate_limits.rs | 4 +-
relay-server/src/utils/multipart.rs | 1 -
relay-server/src/utils/rate_limits.rs | 2 +-
relay-spans/src/span.rs | 2 +-
tools/document-pii/src/main.rs | 2 +-
tools/document-pii/src/pii_finder.rs | 6 ++-
57 files changed, 74 insertions(+), 172 deletions(-)
diff --git a/relay-base-schema/src/data_category.rs b/relay-base-schema/src/data_category.rs
index 25832420da..df24ad590d 100644
--- a/relay-base-schema/src/data_category.rs
+++ b/relay-base-schema/src/data_category.rs
@@ -1,6 +1,5 @@
//! Defines the [`DataCategory`] type that classifies data Relay can handle.
-use std::convert::TryInto;
use std::fmt;
use std::str::FromStr;
diff --git a/relay-cardinality/src/redis/cache.rs b/relay-cardinality/src/redis/cache.rs
index 3da756b365..bf6b73e829 100644
--- a/relay-cardinality/src/redis/cache.rs
+++ b/relay-cardinality/src/redis/cache.rs
@@ -196,8 +196,6 @@ impl ScopedCache {
#[cfg(test)]
mod tests {
- use std::time::Duration;
-
use relay_base_schema::project::ProjectId;
use crate::{CardinalityLimit, CardinalityScope, OrganizationId, Scoping, SlidingWindow};
diff --git a/relay-cardinality/src/redis/limiter.rs b/relay-cardinality/src/redis/limiter.rs
index c7c0490773..b7dfaf8790 100644
--- a/relay-cardinality/src/redis/limiter.rs
+++ b/relay-cardinality/src/redis/limiter.rs
@@ -328,13 +328,11 @@ impl IntoIterator for CheckedLimits {
mod tests {
use std::collections::HashSet;
use std::sync::atomic::AtomicU64;
- use std::time::Duration;
use relay_base_schema::metrics::MetricNamespace;
use relay_base_schema::project::ProjectId;
use relay_redis::{redis, RedisConfigOptions};
- use crate::limiter::EntryId;
use crate::redis::{KEY_PREFIX, KEY_VERSION};
use crate::{CardinalityScope, SlidingWindow};
diff --git a/relay-config/src/byte_size.rs b/relay-config/src/byte_size.rs
index baa6130275..056aa71969 100644
--- a/relay-config/src/byte_size.rs
+++ b/relay-config/src/byte_size.rs
@@ -1,4 +1,3 @@
-use std::convert::TryInto;
use std::fmt;
use std::str::FromStr;
diff --git a/relay-config/src/config.rs b/relay-config/src/config.rs
index d8458d3322..32eb8fc1b6 100644
--- a/relay-config/src/config.rs
+++ b/relay-config/src/config.rs
@@ -1,5 +1,4 @@
use std::collections::{BTreeMap, HashMap};
-use std::convert::TryInto;
use std::error::Error;
use std::io::Write;
use std::net::{IpAddr, SocketAddr, ToSocketAddrs};
diff --git a/relay-event-normalization/src/event.rs b/relay-event-normalization/src/event.rs
index b35815f80a..1b81e549c4 100644
--- a/relay-event-normalization/src/event.rs
+++ b/relay-event-normalization/src/event.rs
@@ -336,7 +336,7 @@ pub fn normalize_ip_addresses(
if let Some(ref mut user) = user.value_mut() {
if let Some(ref mut user_ip) = user.ip_address.value_mut() {
if user_ip.is_auto() {
- *user_ip = client_ip.to_owned();
+ client_ip.clone_into(user_ip)
}
}
}
@@ -1103,18 +1103,12 @@ mod tests {
use insta::assert_debug_snapshot;
use itertools::Itertools;
- use relay_event_schema::protocol::{
- Breadcrumb, Contexts, Csp, DebugMeta, DeviceContext, Event, Headers, IpAddr, Measurements,
- Request, Tags, Values,
- };
- use relay_protocol::{get_value, Annotated, SerializableAnnotated};
+ use relay_event_schema::protocol::{Breadcrumb, Csp, DebugMeta, DeviceContext, Values};
+ use relay_protocol::{get_value, SerializableAnnotated};
use serde_json::json;
use super::*;
- use crate::{
- ClientHints, DynamicMeasurementsConfig, MeasurementsConfig, PerformanceScoreConfig,
- RawUserAgentInfo,
- };
+ use crate::{ClientHints, MeasurementsConfig};
const IOS_MOBILE_EVENT: &str = r#"
{
diff --git a/relay-event-normalization/src/normalize/mod.rs b/relay-event-normalization/src/normalize/mod.rs
index 316c8ede54..07e9729b0a 100644
--- a/relay-event-normalization/src/normalize/mod.rs
+++ b/relay-event-normalization/src/normalize/mod.rs
@@ -530,7 +530,7 @@ mod tests {
Span, SpanId, Stacktrace, TagEntry, Tags, TraceId, User, Values,
};
use relay_protocol::{
- assert_annotated_snapshot, get_path, get_value, ErrorKind, FromValue, SerializableAnnotated,
+ assert_annotated_snapshot, get_path, get_value, ErrorKind, SerializableAnnotated,
};
use serde_json::json;
use similar_asserts::assert_eq;
diff --git a/relay-event-normalization/src/normalize/request.rs b/relay-event-normalization/src/normalize/request.rs
index c510bc6226..13160cc2b2 100644
--- a/relay-event-normalization/src/normalize/request.rs
+++ b/relay-event-normalization/src/normalize/request.rs
@@ -202,7 +202,7 @@ pub fn normalize_request(request: &mut Request) {
#[cfg(test)]
mod tests {
- use relay_event_schema::protocol::{Headers, PairList, Query};
+ use relay_event_schema::protocol::{Headers, PairList};
use relay_protocol::Object;
use similar_asserts::assert_eq;
diff --git a/relay-event-normalization/src/normalize/span/description/sql/parser.rs b/relay-event-normalization/src/normalize/span/description/sql/parser.rs
index b5dd6bba3a..bfb5999483 100644
--- a/relay-event-normalization/src/normalize/span/description/sql/parser.rs
+++ b/relay-event-normalization/src/normalize/span/description/sql/parser.rs
@@ -193,7 +193,7 @@ impl NormalizeVisitor {
if let Some(s) = filter {
match s {
sqlparser::ast::ShowStatementFilter::Like(s)
- | sqlparser::ast::ShowStatementFilter::ILike(s) => *s = "%s".to_owned(),
+ | sqlparser::ast::ShowStatementFilter::ILike(s) => "%s".clone_into(s),
sqlparser::ast::ShowStatementFilter::Where(_) => {}
}
}
@@ -519,7 +519,7 @@ impl VisitorMut for NormalizeVisitor {
Statement::Truncate { .. } => {}
Statement::Msck { .. } => {}
Statement::Directory { path, .. } => {
- *path = "%s".to_owned();
+ "%s".clone_into(path);
}
Statement::Call(_) => {}
Statement::Copy { source, values, .. } => {
diff --git a/relay-event-normalization/src/normalize/span/exclusive_time.rs b/relay-event-normalization/src/normalize/span/exclusive_time.rs
index 381b87afe1..c8ef5dbcf1 100644
--- a/relay-event-normalization/src/normalize/span/exclusive_time.rs
+++ b/relay-event-normalization/src/normalize/span/exclusive_time.rs
@@ -136,10 +136,7 @@ pub fn compute_span_exclusive_time(event: &mut Event) {
#[cfg(test)]
mod tests {
use chrono::{TimeZone, Utc};
- use relay_event_schema::protocol::{
- Contexts, Event, EventType, Span, SpanId, Timestamp, TraceContext, TraceId,
- };
- use relay_protocol::Annotated;
+ use relay_event_schema::protocol::{EventType, Timestamp, TraceId};
use similar_asserts::assert_eq;
use super::*;
diff --git a/relay-event-normalization/src/normalize/span/tag_extraction.rs b/relay-event-normalization/src/normalize/span/tag_extraction.rs
index e537c24e6a..81d2a29146 100644
--- a/relay-event-normalization/src/normalize/span/tag_extraction.rs
+++ b/relay-event-normalization/src/normalize/span/tag_extraction.rs
@@ -773,8 +773,8 @@ fn get_event_start_type(event: &Event) -> Option<&'static str> {
#[cfg(test)]
mod tests {
use insta::assert_debug_snapshot;
- use relay_event_schema::protocol::{Event, Request};
- use relay_protocol::{get_value, Annotated};
+ use relay_event_schema::protocol::Request;
+ use relay_protocol::get_value;
use super::*;
use crate::span::description::{scrub_queries, Mode};
diff --git a/relay-event-normalization/src/normalize/user_agent.rs b/relay-event-normalization/src/normalize/user_agent.rs
index 8131423381..f51b526be4 100644
--- a/relay-event-normalization/src/normalize/user_agent.rs
+++ b/relay-event-normalization/src/normalize/user_agent.rs
@@ -449,7 +449,7 @@ impl FromUserAgentInfo for OsContext {
#[cfg(test)]
mod tests {
- use relay_event_schema::protocol::{Headers, PairList, Request};
+ use relay_event_schema::protocol::{PairList, Request};
use relay_protocol::assert_annotated_snapshot;
use super::*;
diff --git a/relay-event-normalization/src/schema.rs b/relay-event-normalization/src/schema.rs
index 74725adc0e..1007807934 100644
--- a/relay-event-normalization/src/schema.rs
+++ b/relay-event-normalization/src/schema.rs
@@ -120,12 +120,12 @@ fn verify_value_characters(
#[cfg(test)]
mod tests {
- use relay_event_schema::processor::{self, ProcessingState};
+ use relay_event_schema::processor;
use relay_event_schema::protocol::{
CError, ClientSdkInfo, Event, MachException, Mechanism, MechanismMeta, PosixSignal,
RawStacktrace, User,
};
- use relay_protocol::{Annotated, ErrorKind};
+ use relay_protocol::Annotated;
use similar_asserts::assert_eq;
use super::*;
diff --git a/relay-event-normalization/src/transactions/processor.rs b/relay-event-normalization/src/transactions/processor.rs
index 44f82b8cc6..21b5977c23 100644
--- a/relay-event-normalization/src/transactions/processor.rs
+++ b/relay-event-normalization/src/transactions/processor.rs
@@ -342,7 +342,7 @@ mod tests {
use itertools::Itertools;
use relay_common::glob2::LazyGlob;
use relay_event_schema::processor::process_value;
- use relay_event_schema::protocol::{ClientSdkInfo, Contexts, Span, SpanId, TraceId};
+ use relay_event_schema::protocol::{ClientSdkInfo, Contexts, SpanId, TraceId};
use relay_protocol::{assert_annotated_snapshot, get_value};
use crate::{validate_transaction, RedactionRule, TransactionValidationConfig};
diff --git a/relay-event-normalization/src/transactions/rules.rs b/relay-event-normalization/src/transactions/rules.rs
index 8d7f73da48..7694571a98 100644
--- a/relay-event-normalization/src/transactions/rules.rs
+++ b/relay-event-normalization/src/transactions/rules.rs
@@ -169,8 +169,6 @@ impl TransactionNameRule {
#[cfg(test)]
mod tests {
- use chrono::{DateTime, Utc};
-
use super::*;
#[test]
diff --git a/relay-event-normalization/src/trimming.rs b/relay-event-normalization/src/trimming.rs
index 79507f956e..e219668c45 100644
--- a/relay-event-normalization/src/trimming.rs
+++ b/relay-event-normalization/src/trimming.rs
@@ -388,14 +388,10 @@ fn slim_frame_data(frames: &mut Array, frame_allowance: usize) {
mod tests {
use std::iter::repeat;
- use relay_event_schema::processor::MaxChars;
use relay_event_schema::protocol::{
- Breadcrumb, Context, Contexts, Event, Exception, ExtraValue, Frame, RawStacktrace,
- TagEntry, Tags, Values,
- };
- use relay_protocol::{
- Annotated, Map, Meta, Object, Remark, RemarkType, SerializableAnnotated, Value,
+ Breadcrumb, Context, Contexts, Event, Exception, ExtraValue, TagEntry, Tags, Values,
};
+ use relay_protocol::{Map, Remark, SerializableAnnotated};
use similar_asserts::assert_eq;
use super::*;
diff --git a/relay-event-schema/src/protocol/contexts/device.rs b/relay-event-schema/src/protocol/contexts/device.rs
index 211a5f9adc..6e41b91efc 100644
--- a/relay-event-schema/src/protocol/contexts/device.rs
+++ b/relay-event-schema/src/protocol/contexts/device.rs
@@ -216,7 +216,6 @@ impl super::DefaultContext for DeviceContext {
#[cfg(test)]
mod tests {
- use relay_protocol::{Annotated, Object, Value};
use uuid::uuid;
use super::*;
diff --git a/relay-event-schema/src/protocol/contexts/response.rs b/relay-event-schema/src/protocol/contexts/response.rs
index 07484142ee..54c420aeb5 100644
--- a/relay-event-schema/src/protocol/contexts/response.rs
+++ b/relay-event-schema/src/protocol/contexts/response.rs
@@ -84,8 +84,6 @@ impl super::DefaultContext for ResponseContext {
#[cfg(test)]
mod tests {
- use relay_protocol::Annotated;
-
use super::*;
use crate::protocol::{Context, PairList};
diff --git a/relay-event-schema/src/protocol/request.rs b/relay-event-schema/src/protocol/request.rs
index 2114188249..f42728d735 100644
--- a/relay-event-schema/src/protocol/request.rs
+++ b/relay-event-schema/src/protocol/request.rs
@@ -1,5 +1,3 @@
-use std::iter::{FromIterator, IntoIterator};
-
use cookie::Cookie;
#[cfg(feature = "jsonschema")]
use relay_jsonschema_derive::JsonSchema;
diff --git a/relay-event-schema/src/protocol/types.rs b/relay-event-schema/src/protocol/types.rs
index 7600d91de8..fdd243e572 100644
--- a/relay-event-schema/src/protocol/types.rs
+++ b/relay-event-schema/src/protocol/types.rs
@@ -1,7 +1,6 @@
//! Common types of the protocol.
use std::borrow::Cow;
use std::cmp::Ordering;
-use std::iter::{FromIterator, IntoIterator};
use std::ops::{Add, Sub};
use std::str::FromStr;
use std::{fmt, net};
diff --git a/relay-filter/src/common.rs b/relay-filter/src/common.rs
index 8f38ca604a..679709b40b 100644
--- a/relay-filter/src/common.rs
+++ b/relay-filter/src/common.rs
@@ -1,5 +1,4 @@
use std::borrow::Cow;
-use std::convert::TryFrom;
use std::fmt;
use serde::Serialize;
diff --git a/relay-filter/src/generic.rs b/relay-filter/src/generic.rs
index 15200f1c81..948a1d014b 100644
--- a/relay-filter/src/generic.rs
+++ b/relay-filter/src/generic.rs
@@ -173,11 +173,8 @@ mod tests {
use super::*;
- use crate::generic::{should_filter, MAX_SUPPORTED_VERSION};
- use crate::{FilterStatKey, GenericFilterConfig, GenericFiltersConfig};
- use relay_event_schema::protocol::{Event, LenientString};
+ use relay_event_schema::protocol::LenientString;
use relay_protocol::Annotated;
- use relay_protocol::RuleCondition;
fn mock_filters() -> GenericFiltersMap {
vec![
diff --git a/relay-filter/src/legacy_browsers.rs b/relay-filter/src/legacy_browsers.rs
index a5cbaa2d90..3d98d6c722 100644
--- a/relay-filter/src/legacy_browsers.rs
+++ b/relay-filter/src/legacy_browsers.rs
@@ -178,8 +178,6 @@ mod tests {
const SAFARI_UA: &str = "Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.17.4; en-GB) AppleWebKit/605.1.5 (KHTML, like Gecko) Version/6.0 Safari/605.1.5";
const ANDROID_UA: &str = "Mozilla/5.0 (Linux; U; Android 3.2; nl-nl; GT-P6800 Build/HTJ85B) AppleWebKit/534.13 (KHTML, like Gecko) Version/4.0 Safari/534.13";
- use std::collections::BTreeSet;
-
use super::*;
use crate::testutils;
diff --git a/relay-filter/src/releases.rs b/relay-filter/src/releases.rs
index 772d113689..1f7781db8c 100644
--- a/relay-filter/src/releases.rs
+++ b/relay-filter/src/releases.rs
@@ -22,7 +22,7 @@ pub fn should_filter(event: &Event, config: &ReleasesFilterConfig) -> Result<(),
#[cfg(test)]
mod tests {
use relay_common::glob3::GlobPatterns;
- use relay_event_schema::protocol::{Event, LenientString};
+ use relay_event_schema::protocol::LenientString;
use relay_protocol::Annotated;
use super::*;
diff --git a/relay-metrics/src/aggregator.rs b/relay-metrics/src/aggregator.rs
index b6eb4efc7b..bc97c8df5c 100644
--- a/relay-metrics/src/aggregator.rs
+++ b/relay-metrics/src/aggregator.rs
@@ -4,7 +4,6 @@ use std::collections::hash_map::Entry;
use std::collections::{BTreeMap, HashMap};
use std::error::Error;
use std::hash::Hasher;
-use std::iter::FromIterator;
use std::time::Duration;
use std::{fmt, mem};
diff --git a/relay-metrics/src/aggregatorservice.rs b/relay-metrics/src/aggregatorservice.rs
index 32e720eb9c..89496cf55f 100644
--- a/relay-metrics/src/aggregatorservice.rs
+++ b/relay-metrics/src/aggregatorservice.rs
@@ -415,9 +415,8 @@ mod tests {
use std::sync::{Arc, RwLock};
use relay_common::time::UnixTimestamp;
- use relay_system::{FromMessage, Interface};
- use crate::{BucketCountInquiry, BucketMetadata, BucketValue};
+ use crate::{BucketMetadata, BucketValue};
use super::*;
diff --git a/relay-metrics/src/view.rs b/relay-metrics/src/view.rs
index 4bccaa8fdd..ee66442c85 100644
--- a/relay-metrics/src/view.rs
+++ b/relay-metrics/src/view.rs
@@ -710,7 +710,6 @@ fn split_at(bucket: &BucketView<'_>, max_size: usize, min_split_size: usize) ->
#[cfg(test)]
mod tests {
use insta::assert_json_snapshot;
- use relay_common::time::UnixTimestamp;
use super::*;
diff --git a/relay-monitors/src/lib.rs b/relay-monitors/src/lib.rs
index 2f04b7aacf..03f283fa8e 100644
--- a/relay-monitors/src/lib.rs
+++ b/relay-monitors/src/lib.rs
@@ -44,7 +44,7 @@ pub enum ProcessCheckInError {
InvalidEnvironment,
}
-///
+/// Describes the status of the incoming CheckIn.
#[derive(Clone, Copy, Debug, PartialEq, Deserialize, Serialize)]
#[serde(rename_all = "snake_case")]
pub enum CheckInStatus {
diff --git a/relay-pii/src/attachments.rs b/relay-pii/src/attachments.rs
index 1125b07969..c98eb1e91c 100644
--- a/relay-pii/src/attachments.rs
+++ b/relay-pii/src/attachments.rs
@@ -947,9 +947,8 @@ mod tests {
}
#[test]
+ #[allow(clippy::trivial_regex)]
fn test_get_wstr_match() {
- #![allow(clippy::trivial_regex)]
-
let s = "hello there";
let mut b = Vec::from(&b"h\x00e\x00l\x00l\x00o\x00 \x00t\x00h\x00e\x00r\x00e\x00"[..]);
let w = WStr::from_utf16le_mut(b.as_mut_slice()).unwrap();
diff --git a/relay-pii/src/builtin.rs b/relay-pii/src/builtin.rs
index 1c632c42ee..873182800a 100644
--- a/relay-pii/src/builtin.rs
+++ b/relay-pii/src/builtin.rs
@@ -387,7 +387,6 @@ declare_builtin_rules! {
#[cfg(test)]
mod tests {
use std::borrow::Cow;
- use std::collections::BTreeMap;
use relay_event_schema::processor::{
process_value, EnumSet, FieldAttrs, Pii, ProcessingState, ValueType,
diff --git a/relay-pii/src/minidumps.rs b/relay-pii/src/minidumps.rs
index a508487816..e0645d3764 100644
--- a/relay-pii/src/minidumps.rs
+++ b/relay-pii/src/minidumps.rs
@@ -1,7 +1,6 @@
//! Minidump scrubbing.
use std::borrow::Cow;
-use std::convert::TryInto;
use std::num::TryFromIntError;
use std::ops::Range;
use std::str::Utf8Error;
diff --git a/relay-pii/src/processor.rs b/relay-pii/src/processor.rs
index 7a3ec6698b..9e379db759 100644
--- a/relay-pii/src/processor.rs
+++ b/relay-pii/src/processor.rs
@@ -137,7 +137,7 @@ impl<'a> Processor for PiiProcessor<'a> {
match self.process_string(value, meta, state) {
Ok(()) => value.push_str(&basename),
Err(ProcessingAction::DeleteValueHard) | Err(ProcessingAction::DeleteValueSoft) => {
- *value = basename[1..].to_owned();
+ basename[1..].clone_into(value);
}
Err(ProcessingAction::InvalidTransaction(x)) => {
return Err(ProcessingAction::InvalidTransaction(x))
@@ -469,12 +469,10 @@ mod tests {
use insta::assert_debug_snapshot;
use relay_event_schema::processor::process_value;
use relay_event_schema::protocol::{
- Addr, Breadcrumb, DebugImage, DebugMeta, Event, ExtraValue, Headers, LogEntry, Message,
+ Addr, Breadcrumb, DebugImage, DebugMeta, ExtraValue, Headers, LogEntry, Message,
NativeDebugImage, Request, Span, TagEntry, Tags, TraceContext,
};
- use relay_protocol::{
- assert_annotated_snapshot, get_value, Annotated, FromValue, Object, Value,
- };
+ use relay_protocol::{assert_annotated_snapshot, get_value, FromValue, Object};
use serde_json::json;
use super::*;
diff --git a/relay-pii/src/selector.rs b/relay-pii/src/selector.rs
index 9ca57540b5..481c2876d7 100644
--- a/relay-pii/src/selector.rs
+++ b/relay-pii/src/selector.rs
@@ -41,8 +41,10 @@ pub enum InvalidSelectorError {
InternalError,
}
+#[allow(unknown_lints)]
+#[allow(clippy::upper_case_acronyms)]
+#[allow(clippy::empty_docs)]
mod parser {
- #![allow(clippy::upper_case_acronyms)]
use pest_derive::Parser;
#[derive(Parser)]
diff --git a/relay-profiling/src/android.rs b/relay-profiling/src/android.rs
index eecb6d0248..3bf1c74400 100644
--- a/relay-profiling/src/android.rs
+++ b/relay-profiling/src/android.rs
@@ -156,7 +156,10 @@ fn parse_profile(payload: &[u8]) -> Result
profile.metadata.duration_ns = transaction.duration_ns();
profile.metadata.trace_id = transaction.trace_id;
profile.metadata.transaction_id = transaction.id;
- profile.metadata.transaction_name = transaction.name.clone();
+ profile
+ .metadata
+ .transaction_name
+ .clone_from(&transaction.name);
profile.metadata.transaction = Some(transaction);
} else if profile.has_transaction_metadata() {
@@ -198,23 +201,26 @@ pub fn parse_android_profile(
let mut profile = parse_profile(payload)?;
if let Some(transaction_name) = transaction_metadata.get("transaction") {
- profile.metadata.transaction_name = transaction_name.to_owned();
+ transaction_name.clone_into(&mut profile.metadata.transaction_name);
if let Some(ref mut transaction) = profile.metadata.transaction {
- transaction.name = profile.metadata.transaction_name.to_owned();
+ profile
+ .metadata
+ .transaction_name
+ .clone_into(&mut transaction.name);
}
}
if let Some(release) = transaction_metadata.get("release") {
- profile.metadata.release = release.to_owned();
+ release.clone_into(&mut profile.metadata.release);
}
if let Some(dist) = transaction_metadata.get("dist") {
- profile.metadata.dist = dist.to_owned();
+ dist.clone_into(&mut profile.metadata.dist);
}
if let Some(environment) = transaction_metadata.get("environment") {
- profile.metadata.environment = environment.to_owned();
+ environment.clone_into(&mut profile.metadata.environment);
}
if let Some(segment_id) = transaction_metadata.get("segment_id") {
diff --git a/relay-profiling/src/extract_from_transaction.rs b/relay-profiling/src/extract_from_transaction.rs
index 3700b38ee2..cc77ef2942 100644
--- a/relay-profiling/src/extract_from_transaction.rs
+++ b/relay-profiling/src/extract_from_transaction.rs
@@ -101,7 +101,6 @@ fn extract_http_method(transaction: &Event) -> Option {
#[cfg(test)]
mod tests {
use super::*;
- use relay_event_schema::protocol::Event;
use relay_protocol::FromValue;
#[test]
diff --git a/relay-profiling/src/sample.rs b/relay-profiling/src/sample.rs
index 5ac3081ba3..2f48a017c6 100644
--- a/relay-profiling/src/sample.rs
+++ b/relay-profiling/src/sample.rs
@@ -374,7 +374,7 @@ pub fn parse_sample_profile(
if let Some(transaction_name) = transaction_metadata.get("transaction") {
if let Some(ref mut transaction) = profile.metadata.transaction {
- transaction.name = transaction_name.to_owned();
+ transaction_name.clone_into(&mut transaction.name)
}
}
@@ -386,11 +386,11 @@ pub fn parse_sample_profile(
}
if let Some(dist) = transaction_metadata.get("dist") {
- profile.metadata.dist = dist.to_owned();
+ dist.clone_into(&mut profile.metadata.dist);
}
if let Some(environment) = transaction_metadata.get("environment") {
- profile.metadata.environment = environment.to_owned();
+ environment.clone_into(&mut profile.metadata.environment);
}
if let Some(segment_id) = transaction_metadata.get("segment_id") {
@@ -407,8 +407,6 @@ pub fn parse_sample_profile(
#[cfg(test)]
mod tests {
- use relay_event_schema::protocol::SpanId;
-
use super::*;
use std::time::Duration;
diff --git a/relay-quotas/src/redis.rs b/relay-quotas/src/redis.rs
index 8c2f6c5bf8..54a8c15d75 100644
--- a/relay-quotas/src/redis.rs
+++ b/relay-quotas/src/redis.rs
@@ -307,7 +307,6 @@ impl RedisRateLimiter {
#[cfg(test)]
mod tests {
- use std::sync::Arc;
use std::time::{SystemTime, UNIX_EPOCH};
use relay_base_schema::metrics::MetricNamespace;
diff --git a/relay-sampling/src/evaluation.rs b/relay-sampling/src/evaluation.rs
index 9fa66e0b65..5f2747d27d 100644
--- a/relay-sampling/src/evaluation.rs
+++ b/relay-sampling/src/evaluation.rs
@@ -395,16 +395,12 @@ impl fmt::Display for MatchedRuleIds {
mod tests {
use std::str::FromStr;
- use chrono::{TimeZone, Utc};
+ use chrono::TimeZone;
use relay_protocol::RuleCondition;
use similar_asserts::assert_eq;
- use uuid::Uuid;
- use crate::config::{
- DecayingFunction, RuleId, RuleType, SamplingRule, SamplingValue, TimeRange,
- };
+ use crate::config::{DecayingFunction, RuleType, TimeRange};
use crate::dsc::TraceUserContext;
- use crate::evaluation::MatchedRuleIds;
use crate::DynamicSamplingContext;
use super::*;
@@ -475,8 +471,8 @@ mod tests {
match path {
"trace.release" => dsc.release = Some(value.to_owned()),
"trace.environment" => dsc.environment = Some(value.to_owned()),
- "trace.user.id" => dsc.user.user_id = value.to_owned(),
- "trace.user.segment" => dsc.user.user_segment = value.to_owned(),
+ "trace.user.id" => value.clone_into(&mut dsc.user.user_id),
+ "trace.user.segment" => value.clone_into(&mut dsc.user.user_segment),
"trace.transaction" => dsc.transaction = Some(value.to_owned()),
"trace.replay_id" => dsc.replay_id = Some(Uuid::from_str(value).unwrap()),
_ => panic!("invalid path"),
diff --git a/relay-server/src/metrics_extraction/sessions/mod.rs b/relay-server/src/metrics_extraction/sessions/mod.rs
index df35f7ce69..902eba3314 100644
--- a/relay-server/src/metrics_extraction/sessions/mod.rs
+++ b/relay-server/src/metrics_extraction/sessions/mod.rs
@@ -178,7 +178,7 @@ pub fn extract_session_metrics(
#[cfg(test)]
mod tests {
- use relay_event_schema::protocol::{AbnormalMechanism, SessionAggregates, SessionUpdate};
+ use relay_event_schema::protocol::{SessionAggregates, SessionUpdate};
use relay_metrics::BucketValue;
use super::*;
diff --git a/relay-server/src/services/outcome.rs b/relay-server/src/services/outcome.rs
index bfec918dcd..ab24adf486 100644
--- a/relay-server/src/services/outcome.rs
+++ b/relay-server/src/services/outcome.rs
@@ -6,7 +6,6 @@
use std::borrow::Cow;
use std::collections::BTreeMap;
-use std::convert::TryInto;
use std::error::Error;
use std::net::IpAddr;
use std::sync::Arc;
@@ -528,13 +527,12 @@ impl FromMessage for TrackRawOutcome {
}
#[derive(Debug)]
+#[cfg(feature = "processing")]
#[cfg_attr(feature = "processing", derive(thiserror::Error))]
pub enum OutcomeError {
#[error("failed to send kafka message")]
- #[cfg(feature = "processing")]
SendFailed(ClientError),
#[error("json serialization error")]
- #[cfg(feature = "processing")]
SerializationError(serde_json::Error),
}
diff --git a/relay-server/src/services/processor.rs b/relay-server/src/services/processor.rs
index ff01fd1f9c..7430dc546e 100644
--- a/relay-server/src/services/processor.rs
+++ b/relay-server/src/services/processor.rs
@@ -2821,21 +2821,16 @@ impl<'a> IntoIterator for DynamicQuotas<'a> {
#[cfg(test)]
mod tests {
- use std::collections::BTreeMap;
use std::env;
- use chrono::{DateTime, Utc};
use relay_base_schema::metrics::{DurationUnit, MetricUnit};
use relay_common::glob2::LazyGlob;
use relay_dynamic_config::ProjectConfig;
- use relay_event_normalization::{
- normalize_event, MeasurementsConfig, RedactionRule, TransactionNameRule,
- };
- use relay_event_schema::protocol::{EventId, TransactionSource};
+ use relay_event_normalization::{RedactionRule, TransactionNameRule};
+ use relay_event_schema::protocol::TransactionSource;
use relay_pii::DataScrubbingConfig;
use similar_asserts::assert_eq;
- use crate::extractors::RequestMeta;
use crate::metrics_extraction::transactions::types::{
CommonTags, TransactionMeasurementTags, TransactionMetric,
};
@@ -2846,7 +2841,7 @@ mod tests {
use {
relay_dynamic_config::Options,
relay_metrics::BucketValue,
- relay_quotas::{Quota, QuotaScope, ReasonCode},
+ relay_quotas::{QuotaScope, ReasonCode},
relay_test::mock_service,
};
diff --git a/relay-server/src/services/processor/dynamic_sampling.rs b/relay-server/src/services/processor/dynamic_sampling.rs
index 364a6dee93..93e69ab6f0 100644
--- a/relay-server/src/services/processor/dynamic_sampling.rs
+++ b/relay-server/src/services/processor/dynamic_sampling.rs
@@ -298,7 +298,7 @@ mod tests {
use relay_sampling::evaluation::{ReservoirCounters, SamplingMatch};
use uuid::Uuid;
- use crate::envelope::{ContentType, Envelope, Item, ItemType};
+ use crate::envelope::{ContentType, Envelope, Item};
use crate::extractors::RequestMeta;
use crate::services::processor::{ProcessEnvelope, ProcessingGroup};
use crate::services::project::ProjectState;
diff --git a/relay-server/src/services/processor/event.rs b/relay-server/src/services/processor/event.rs
index 7ca7233d5c..60ce46a60e 100644
--- a/relay-server/src/services/processor/event.rs
+++ b/relay-server/src/services/processor/event.rs
@@ -773,8 +773,6 @@ mod tests {
use chrono::{DateTime, TimeZone, Utc};
- use crate::envelope::ContentType;
-
use super::*;
fn create_breadcrumbs_item(breadcrumbs: &[(Option>, &str)]) -> Item {
diff --git a/relay-server/src/services/processor/profile.rs b/relay-server/src/services/processor/profile.rs
index 84a0682c2f..dc8c98ad0e 100644
--- a/relay-server/src/services/processor/profile.rs
+++ b/relay-server/src/services/processor/profile.rs
@@ -131,13 +131,15 @@ mod tests {
use std::sync::Arc;
use insta::assert_debug_snapshot;
- use relay_event_schema::protocol::{Event, EventId};
+ #[cfg(not(feature = "processing"))]
+ use relay_dynamic_config::Feature;
+ use relay_event_schema::protocol::EventId;
use relay_sampling::evaluation::ReservoirCounters;
use relay_system::Addr;
- use crate::envelope::{ContentType, Envelope, Item};
+ use crate::envelope::Envelope;
use crate::extractors::RequestMeta;
- use crate::services::processor::{Feature, ProcessEnvelope, ProcessingGroup};
+ use crate::services::processor::{ProcessEnvelope, ProcessingGroup};
use crate::services::project::ProjectState;
use crate::testutils::create_test_processor;
use crate::utils::ManagedEnvelope;
diff --git a/relay-server/src/services/processor/replay.rs b/relay-server/src/services/processor/replay.rs
index 3d1a07046d..b11fb612c7 100644
--- a/relay-server/src/services/processor/replay.rs
+++ b/relay-server/src/services/processor/replay.rs
@@ -13,7 +13,6 @@ use relay_pii::PiiProcessor;
use relay_protocol::Annotated;
use relay_replays::recording::RecordingScrubber;
use relay_statsd::metric;
-use rmp_serde;
use serde::{Deserialize, Serialize};
use crate::envelope::{ContentType, ItemType};
diff --git a/relay-server/src/services/project.rs b/relay-server/src/services/project.rs
index e783d38645..58708dff3c 100644
--- a/relay-server/src/services/project.rs
+++ b/relay-server/src/services/project.rs
@@ -1256,7 +1256,7 @@ fn is_metric_namespace_valid(state: &ProjectState, namespace: &MetricNamespace)
#[cfg(test)]
mod tests {
use std::collections::BTreeMap;
- use std::sync::{Arc, Mutex};
+ use std::sync::Mutex;
use relay_common::glob3::GlobPatterns;
use relay_common::time::UnixTimestamp;
diff --git a/relay-server/src/services/project_cache.rs b/relay-server/src/services/project_cache.rs
index a88ee3613f..c5e564a6d7 100644
--- a/relay-server/src/services/project_cache.rs
+++ b/relay-server/src/services/project_cache.rs
@@ -1176,8 +1176,6 @@ impl FetchOptionalProjectState {
#[cfg(test)]
mod tests {
- use std::time::Duration;
-
use relay_test::mock_service;
use tokio::select;
use uuid::Uuid;
diff --git a/relay-server/src/services/project_local.rs b/relay-server/src/services/project_local.rs
index 1a6a0010d7..2307462b3c 100644
--- a/relay-server/src/services/project_local.rs
+++ b/relay-server/src/services/project_local.rs
@@ -193,7 +193,7 @@ mod tests {
use std::str::FromStr;
use super::*;
- use crate::services::project::{ProjectState, PublicKeyConfig};
+ use crate::services::project::PublicKeyConfig;
/// Tests that we can follow the symlinks and read the project file properly.
#[tokio::test]
@@ -277,7 +277,7 @@ mod tests {
let extracted_project_state = load_local_states(temp.path()).await.unwrap();
assert_eq!(extracted_project_state.len(), 2);
- assert!(extracted_project_state.get(&project_key1).is_some());
- assert!(extracted_project_state.get(&project_key2).is_some());
+ assert!(extracted_project_state.contains_key(&project_key1));
+ assert!(extracted_project_state.contains_key(&project_key2));
}
}
diff --git a/relay-server/src/services/spooler/mod.rs b/relay-server/src/services/spooler/mod.rs
index 237f52b826..c364ba9cbd 100644
--- a/relay-server/src/services/spooler/mod.rs
+++ b/relay-server/src/services/spooler/mod.rs
@@ -1274,7 +1274,6 @@ mod tests {
use rand::Rng;
use relay_system::AsyncResponse;
use relay_test::mock_service;
- use sqlx::sqlite::SqliteConnectOptions;
use sqlx::ConnectOptions;
use uuid::Uuid;
diff --git a/relay-server/src/services/store.rs b/relay-server/src/services/store.rs
index ba34309d44..bc5dc79a11 100644
--- a/relay-server/src/services/store.rs
+++ b/relay-server/src/services/store.rs
@@ -1347,53 +1347,6 @@ struct AttachmentKafkaMessage {
attachment: ChunkedAttachment,
}
-/// Container payload for chunks of attachments.
-#[derive(Debug, Serialize)]
-struct ReplayRecordingChunkKafkaMessage {
- /// Chunk payload of the replay recording.
- payload: Bytes,
- /// The replay id.
- replay_id: EventId,
- /// The project id for the current replay.
- project_id: ProjectId,
- /// The recording ID within the replay.
- id: String,
- /// Sequence number of chunk. Starts at 0 and ends at `ReplayRecordingKafkaMessage.num_chunks - 1`.
- /// the tuple (id, chunk_index) is the unique identifier for a single chunk.
- chunk_index: usize,
-}
-#[derive(Debug, Serialize)]
-struct ReplayRecordingChunkMeta {
- /// The attachment ID within the event.
- ///
- /// The triple `(project_id, event_id, id)` identifies an attachment uniquely.
- id: String,
-
- /// Number of chunks. Must be greater than zero.
- chunks: usize,
-
- /// The size of the attachment in bytes.
- #[serde(skip_serializing_if = "Option::is_none")]
- size: Option,
-}
-
-#[derive(Debug, Serialize)]
-struct ReplayRecordingKafkaMessage {
- replay_id: EventId,
- /// The key_id for the current recording.
- key_id: Option,
- /// The org id for the current recording.
- org_id: u64,
- /// The project id for the current recording.
- project_id: ProjectId,
- /// The timestamp of when the recording was Received by relay
- received: u64,
- // Number of days to retain.
- retention_days: u16,
- /// The recording attachment.
- replay_recording: ReplayRecordingChunkMeta,
-}
-
#[derive(Debug, Serialize)]
struct ReplayRecordingNotChunkedKafkaMessage<'a> {
replay_id: EventId,
diff --git a/relay-server/src/utils/dynamic_sampling.rs b/relay-server/src/utils/dynamic_sampling.rs
index 35c072a1d8..6bd4e3a56e 100644
--- a/relay-server/src/utils/dynamic_sampling.rs
+++ b/relay-server/src/utils/dynamic_sampling.rs
@@ -145,11 +145,10 @@ pub fn dsc_from_event(public_key: ProjectKey, event: &Event) -> Option Event {
diff --git a/relay-server/src/utils/metrics_rate_limits.rs b/relay-server/src/utils/metrics_rate_limits.rs
index 6b13afd9f1..6e1b7f5b84 100644
--- a/relay-server/src/utils/metrics_rate_limits.rs
+++ b/relay-server/src/utils/metrics_rate_limits.rs
@@ -444,8 +444,8 @@ impl>> MetricsLimiter {
#[cfg(test)]
mod tests {
use relay_base_schema::project::{ProjectId, ProjectKey};
- use relay_metrics::{Bucket, BucketMetadata, BucketValue};
- use relay_quotas::{Quota, QuotaScope};
+ use relay_metrics::{BucketMetadata, BucketValue};
+ use relay_quotas::QuotaScope;
use smallvec::smallvec;
use super::*;
diff --git a/relay-server/src/utils/multipart.rs b/relay-server/src/utils/multipart.rs
index 305b45bfba..9ec285f9a1 100644
--- a/relay-server/src/utils/multipart.rs
+++ b/relay-server/src/utils/multipart.rs
@@ -1,4 +1,3 @@
-use std::convert::TryInto;
use std::io;
use axum::extract::multipart::{Field, Multipart};
diff --git a/relay-server/src/utils/rate_limits.rs b/relay-server/src/utils/rate_limits.rs
index bb37e9de01..e625be9d23 100644
--- a/relay-server/src/utils/rate_limits.rs
+++ b/relay-server/src/utils/rate_limits.rs
@@ -729,7 +729,7 @@ mod tests {
use relay_base_schema::project::{ProjectId, ProjectKey};
use relay_dynamic_config::TransactionMetricsConfig;
- use relay_quotas::{ItemScoping, RetryAfter};
+ use relay_quotas::RetryAfter;
use smallvec::smallvec;
use super::*;
diff --git a/relay-spans/src/span.rs b/relay-spans/src/span.rs
index cdeee789cd..e1f69cca3d 100644
--- a/relay-spans/src/span.rs
+++ b/relay-spans/src/span.rs
@@ -197,7 +197,7 @@ pub fn otel_to_sentry_span(otel_span: OtelSpan) -> EventSpan {
#[cfg(test)]
mod tests {
use super::*;
- use relay_protocol::{get_path, Annotated};
+ use relay_protocol::get_path;
#[test]
fn parse_span() {
diff --git a/tools/document-pii/src/main.rs b/tools/document-pii/src/main.rs
index b42e31e350..5a79eedb8c 100644
--- a/tools/document-pii/src/main.rs
+++ b/tools/document-pii/src/main.rs
@@ -169,7 +169,7 @@ fn main() {
mod tests {
use path_slash::PathBufExt;
- use crate::item_collector::{AstItemCollector, TypesAndScopedPaths};
+ use crate::item_collector::TypesAndScopedPaths;
use super::*;
diff --git a/tools/document-pii/src/pii_finder.rs b/tools/document-pii/src/pii_finder.rs
index 52595b0d5f..64048406bc 100644
--- a/tools/document-pii/src/pii_finder.rs
+++ b/tools/document-pii/src/pii_finder.rs
@@ -122,7 +122,11 @@ impl<'a> PiiFinder<'a> {
// return to this function after the match statement, we can set them back.
let current_type = self.current_type.clone();
let module_path = self.module_path.clone();
- self.module_path = use_path.rsplit_once("::").unwrap().0.to_owned();
+ use_path
+ .rsplit_once("::")
+ .unwrap()
+ .0
+ .clone_into(&mut self.module_path);
match enum_or_struct {
EnumOrStruct::Struct(itemstruct) => self.visit_item_struct(&itemstruct),