diff --git a/relay-cabi/src/core.rs b/relay-cabi/src/core.rs index 92501c5ce49..b7a9ee50519 100644 --- a/relay-cabi/src/core.rs +++ b/relay-cabi/src/core.rs @@ -135,11 +135,7 @@ impl From for RelayUuid { #[unsafe(no_mangle)] #[relay_ffi::catch_unwind] pub unsafe extern "C" fn relay_uuid_is_nil(uuid: *const RelayUuid) -> bool { - if let Ok(uuid) = Uuid::from_slice(unsafe { &(*uuid).data[..] }) { - uuid == Uuid::nil() - } else { - false - } + Uuid::from_bytes(unsafe { (*uuid).data }) == Uuid::nil() } /// Formats the UUID into a string. @@ -149,7 +145,7 @@ pub unsafe extern "C" fn relay_uuid_is_nil(uuid: *const RelayUuid) -> bool { #[unsafe(no_mangle)] #[relay_ffi::catch_unwind] pub unsafe extern "C" fn relay_uuid_to_str(uuid: *const RelayUuid) -> RelayStr { - let uuid = Uuid::from_slice(unsafe { &(*uuid).data[..] }).unwrap_or_else(|_| Uuid::nil()); + let uuid = Uuid::from_bytes(unsafe { (*uuid).data }); RelayStr::from_string(uuid.as_hyphenated().to_string()) } diff --git a/relay-config/src/config.rs b/relay-config/src/config.rs index 2018c6dad01..72e8e52b2b2 100644 --- a/relay-config/src/config.rs +++ b/relay-config/src/config.rs @@ -2247,7 +2247,7 @@ impl Config { } let file_name = path.file_name().and_then(|f| f.to_str())?; - let new_file_name = format!("{}.{}", file_name, partition_id); + let new_file_name = format!("{file_name}.{partition_id}"); path.set_file_name(new_file_name); Some(path) diff --git a/relay-event-normalization/src/normalize/contexts.rs b/relay-event-normalization/src/normalize/contexts.rs index 5d922748f28..fa62a8bf44b 100644 --- a/relay-event-normalization/src/normalize/contexts.rs +++ b/relay-event-normalization/src/normalize/contexts.rs @@ -145,7 +145,7 @@ fn normalize_runtime_context(runtime: &mut RuntimeContext) { // The equivalent calculation is done in `sentry` in `src/sentry/interfaces/contexts.py`. if runtime.runtime.value().is_none() { if let (Some(name), Some(version)) = (runtime.name.value(), runtime.version.value()) { - runtime.runtime = Annotated::from(format!("{} {}", name, version)); + runtime.runtime = Annotated::from(format!("{name} {version}")); } } } @@ -270,7 +270,7 @@ fn compute_os_context(os: &mut OsContext) { // The equivalent calculation is done in `sentry` in `src/sentry/interfaces/contexts.py`. if os.os.value().is_none() { if let (Some(name), Some(version)) = (os.name.value(), os.version.value()) { - os.os = Annotated::from(format!("{} {}", name, version)); + os.os = Annotated::from(format!("{name} {version}")); } } } @@ -280,7 +280,7 @@ fn normalize_browser_context(browser: &mut BrowserContext) { // The equivalent calculation is done in `sentry` in `src/sentry/interfaces/contexts.py`. if browser.browser.value().is_none() { if let (Some(name), Some(version)) = (browser.name.value(), browser.version.value()) { - browser.browser = Annotated::from(format!("{} {}", name, version)); + browser.browser = Annotated::from(format!("{name} {version}")); } } } diff --git a/relay-event-normalization/src/normalize/span/description/mod.rs b/relay-event-normalization/src/normalize/span/description/mod.rs index 4c91e58ced6..1db513cbd8a 100644 --- a/relay-event-normalization/src/normalize/span/description/mod.rs +++ b/relay-event-normalization/src/normalize/span/description/mod.rs @@ -1415,7 +1415,7 @@ mod tests { for (url, allowed_hosts, expected) in examples { let json = format!( r#"{{ - "description": "POST {}", + "description": "POST {url}", "span_id": "bd2eb23da2beb459", "start_timestamp": 1597976393.4619668, "timestamp": 1597976393.4718769, @@ -1423,7 +1423,6 @@ mod tests { "op": "http.client" }} "#, - url, ); let mut span = Annotated::::from_json(&json).unwrap(); @@ -1433,7 +1432,7 @@ mod tests { assert_eq!( scrubbed.0.as_deref(), - Some(format!("POST {}", expected).as_str()), + Some(format!("POST {expected}").as_str()), "Could not match {url}" ); } diff --git a/relay-event-normalization/src/timestamp.rs b/relay-event-normalization/src/timestamp.rs index e37efd5ed53..b639f2ad9db 100644 --- a/relay-event-normalization/src/timestamp.rs +++ b/relay-event-normalization/src/timestamp.rs @@ -53,8 +53,7 @@ impl Processor for TimestampProcessor { if let Some(start_timestamp) = span.start_timestamp.value() { if start_timestamp.into_inner().timestamp_millis() < 0 { meta.add_error(Error::invalid(format!( - "start_timestamp is too stale: {}", - start_timestamp + "start_timestamp is too stale: {start_timestamp}" ))); return Err(ProcessingAction::DeleteValueHard); } @@ -62,8 +61,7 @@ impl Processor for TimestampProcessor { if let Some(end_timestamp) = span.timestamp.value() { if end_timestamp.into_inner().timestamp_millis() < 0 { meta.add_error(Error::invalid(format!( - "timestamp is too stale: {}", - end_timestamp + "timestamp is too stale: {end_timestamp}" ))); return Err(ProcessingAction::DeleteValueHard); } @@ -81,8 +79,7 @@ impl Processor for TimestampProcessor { if let Some(timestamp) = breadcrumb.timestamp.value() { if timestamp.into_inner().timestamp_millis() < 0 { meta.add_error(Error::invalid(format!( - "timestamp is too stale: {}", - timestamp + "timestamp is too stale: {timestamp}" ))); return Err(ProcessingAction::DeleteValueHard); } diff --git a/relay-event-schema/src/protocol/thread.rs b/relay-event-schema/src/protocol/thread.rs index f0480952da6..2f25b88a376 100644 --- a/relay-event-schema/src/protocol/thread.rs +++ b/relay-event-schema/src/protocol/thread.rs @@ -73,8 +73,8 @@ impl Empty for ThreadId { impl fmt::Display for ThreadId { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { match self { - ThreadId::Int(id) => write!(f, "{}", id), - ThreadId::String(id) => write!(f, "{}", id), + ThreadId::Int(id) => write!(f, "{id}"), + ThreadId::String(id) => write!(f, "{id}"), } } } diff --git a/relay-filter/src/transaction_name.rs b/relay-filter/src/transaction_name.rs index 3900f83b63d..b0626af9d38 100644 --- a/relay-filter/src/transaction_name.rs +++ b/relay-filter/src/transaction_name.rs @@ -247,8 +247,7 @@ mod tests { assert_eq!( filter_result, Ok(()), - "Event filtered for event_type={} although filter should have not matched", - event_type + "Event filtered for event_type={event_type} although filter should have not matched" ) } } diff --git a/relay-log/src/setup.rs b/relay-log/src/setup.rs index 1ae5cd5149d..4d90e85b6cc 100644 --- a/relay-log/src/setup.rs +++ b/relay-log/src/setup.rs @@ -126,7 +126,7 @@ impl Level { impl Display for Level { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - write!(f, "{}", format!("{:?}", self).to_lowercase()) + write!(f, "{}", format!("{self:?}").to_lowercase()) } } diff --git a/relay-profiling/src/sample/v2.rs b/relay-profiling/src/sample/v2.rs index 0b61a0358e4..a5b0d2119b4 100644 --- a/relay-profiling/src/sample/v2.rs +++ b/relay-profiling/src/sample/v2.rs @@ -221,10 +221,10 @@ mod tests { fn test_roundtrip() { let first_payload = include_bytes!("../../tests/fixtures/sample/v2/valid.json"); let first_parse = parse(first_payload); - assert!(first_parse.is_ok(), "{:#?}", first_parse); + assert!(first_parse.is_ok(), "{first_parse:#?}"); let second_payload = serde_json::to_vec(&first_parse.unwrap()).unwrap(); let second_parse = parse(&second_payload[..]); - assert!(second_parse.is_ok(), "{:#?}", second_parse); + assert!(second_parse.is_ok(), "{second_parse:#?}"); } #[test] diff --git a/relay-profiling/src/utils.rs b/relay-profiling/src/utils.rs index 1e9906c7e23..0d64d2f4359 100644 --- a/relay-profiling/src/utils.rs +++ b/relay-profiling/src/utils.rs @@ -31,16 +31,13 @@ where AnyType::String(s) => s.parse::().map_err(serde::de::Error::custom), AnyType::Number(n) => Ok(n), AnyType::Bool(v) => Err(serde::de::Error::custom(format!( - "unsupported value: {:?}", - v + "unsupported value: {v:?}" ))), AnyType::Array(v) => Err(serde::de::Error::custom(format!( - "unsupported value: {:?}", - v + "unsupported value: {v:?}" ))), AnyType::Object(v) => Err(serde::de::Error::custom(format!( - "unsupported value: {:?}", - v + "unsupported value: {v:?}" ))), AnyType::Null => Err(serde::de::Error::custom("unsupported null value")), } diff --git a/relay-prosperoconv/build.rs b/relay-prosperoconv/build.rs index 857a61aa891..e5415ef713f 100644 --- a/relay-prosperoconv/build.rs +++ b/relay-prosperoconv/build.rs @@ -40,7 +40,7 @@ fn main() { "clone", "git@github.com:getsentry/tempest.git", &temp_dir_str, - &format!("--revision={}", version), + &format!("--revision={version}"), "--depth=1", ]) .status() @@ -52,7 +52,7 @@ fn main() { "clone", "https://github.com/getsentry/tempest.git", &temp_dir_str, - &format!("--revision={}", version), + &format!("--revision={version}"), "--depth=1", ]) .status() diff --git a/relay-quotas/src/redis.rs b/relay-quotas/src/redis.rs index d06107e0a32..63cd7e4da77 100644 --- a/relay-quotas/src/redis.rs +++ b/relay-quotas/src/redis.rs @@ -493,7 +493,7 @@ mod tests { scope_id: None, limit: Some(quota_limit), window: Some(600), - reason_code: Some(ReasonCode::new(format!("ns: {:?}", namespace))), + reason_code: Some(ReasonCode::new(format!("ns: {namespace:?}"))), namespace, } }; diff --git a/relay-sampling/src/redis_sampling.rs b/relay-sampling/src/redis_sampling.rs index f9fdfae4852..703be71a7bc 100644 --- a/relay-sampling/src/redis_sampling.rs +++ b/relay-sampling/src/redis_sampling.rs @@ -8,7 +8,7 @@ pub struct ReservoirRuleKey(String); impl ReservoirRuleKey { pub fn new(org_id: OrganizationId, rule_id: RuleId) -> Self { - Self(format!("reservoir:{}:{}", org_id, rule_id)) + Self(format!("reservoir:{org_id}:{rule_id}")) } fn as_str(&self) -> &str { diff --git a/relay-server/benches/benches.rs b/relay-server/benches/benches.rs index 5db3f7f8d79..07f24856603 100644 --- a/relay-server/benches/benches.rs +++ b/relay-server/benches/benches.rs @@ -58,11 +58,10 @@ fn mock_envelope_with_project_key(project_key: &ProjectKey, size: &str) -> Box = (0..num_projects) - .map(|i| ProjectKey::parse(&format!("{:#032x}", i)).unwrap()) + .map(|i| ProjectKey::parse(&format!("{i:#032x}")).unwrap()) .collect(); let mut envelopes = vec![]; @@ -277,7 +276,7 @@ fn benchmark_envelope_buffer(c: &mut Criterion) { b.iter_with_setup( || { let project_keys: Vec<_> = (0..num_projects) - .map(|i| ProjectKey::parse(&format!("{:#032x}", i)).unwrap()) + .map(|i| ProjectKey::parse(&format!("{i:#032x}")).unwrap()) .collect(); let mut envelopes = vec![]; diff --git a/relay-server/src/metrics_extraction/transactions/mod.rs b/relay-server/src/metrics_extraction/transactions/mod.rs index a5b5fc156e3..eea58bdc422 100644 --- a/relay-server/src/metrics_extraction/transactions/mod.rs +++ b/relay-server/src/metrics_extraction/transactions/mod.rs @@ -2083,7 +2083,7 @@ mod tests { ), ] { let config: TransactionMetricsConfig = serde_json::from_str(config_str).unwrap(); - assert_eq!(config.deprecated1, expected_strategy, "{}", config_str); + assert_eq!(config.deprecated1, expected_strategy, "{config_str}"); } } diff --git a/relay-server/src/services/outcome.rs b/relay-server/src/services/outcome.rs index 8ddb1c47251..d8bd49c29e3 100644 --- a/relay-server/src/services/outcome.rs +++ b/relay-server/src/services/outcome.rs @@ -247,7 +247,7 @@ impl fmt::Display for Outcome { Outcome::RateLimited(None) => write!(f, "rate limited"), Outcome::RateLimited(Some(reason)) => write!(f, "rate limited with reason {reason}"), #[cfg(feature = "processing")] - Outcome::CardinalityLimited(id) => write!(f, "cardinality limited ({})", id), + Outcome::CardinalityLimited(id) => write!(f, "cardinality limited ({id})"), Outcome::Invalid(DiscardReason::Internal) => write!(f, "internal error"), Outcome::Invalid(reason) => write!(f, "invalid data ({reason})"), Outcome::Abuse => write!(f, "abuse limit reached"), diff --git a/relay-server/src/services/processor/span.rs b/relay-server/src/services/processor/span.rs index 653cd248fe7..34ce1ed64d2 100644 --- a/relay-server/src/services/processor/span.rs +++ b/relay-server/src/services/processor/span.rs @@ -328,12 +328,12 @@ mod tests { let attribute_value = |key: &str| -> String { match attributes .get(key) - .unwrap_or_else(|| panic!("attribute {} missing", key)) + .unwrap_or_else(|| panic!("attribute {key} missing")) .to_owned() .value { Some(Value::StringValue(str)) => str, - _ => panic!("attribute {} not a string", key), + _ => panic!("attribute {key} not a string"), } }; assert_eq!( diff --git a/relay-spans/src/v2_to_v1.rs b/relay-spans/src/v2_to_v1.rs index 3d31b7c8b8f..1243ae30495 100644 --- a/relay-spans/src/v2_to_v1.rs +++ b/relay-spans/src/v2_to_v1.rs @@ -318,14 +318,14 @@ fn derive_http_description(attributes: &Attributes, kind: &Option<&SpanV2Kind>) let Some(url_path) = url_path else { return Some(description); }; - let base_description = format!("{} {}", http_method, url_path); + let base_description = format!("{http_method} {url_path}"); // Check for GraphQL operations if let Some(graphql_ops) = attributes .get_value("sentry.graphql.operation") .and_then(|v| v.as_str()) { - return Some(format!("{} ({})", base_description, graphql_ops)); + return Some(format!("{base_description} ({graphql_ops})")); } Some(base_description) diff --git a/relay-threading/benches/pool.rs b/relay-threading/benches/pool.rs index 8001cd67bee..20f24da332c 100644 --- a/relay-threading/benches/pool.rs +++ b/relay-threading/benches/pool.rs @@ -94,7 +94,7 @@ fn bench_pool_scaling(c: &mut Criterion) { // Test with different task counts for tasks in [100, 1000, 10000].iter() { group.bench_with_input( - BenchmarkId::new(format!("threads_{}", threads), tasks), + BenchmarkId::new(format!("threads_{threads}"), tasks), tasks, |b, &tasks| { b.to_async(&runtime).iter(|| run_benchmark(&pool, tasks)); @@ -117,7 +117,7 @@ fn bench_multi_threaded_spawn(c: &mut Criterion) { // Test with different task counts for tasks in [1000, 10000].iter() { group.bench_with_input( - BenchmarkId::new(format!("spawn_threads_{}", spawn_threads), tasks), + BenchmarkId::new(format!("spawn_threads_{spawn_threads}"), tasks), tasks, |b, &tasks| { b.to_async(&runtime).iter(|| async { diff --git a/relay-threading/src/pool.rs b/relay-threading/src/pool.rs index 361b4a2ab65..5134364a48f 100644 --- a/relay-threading/src/pool.rs +++ b/relay-threading/src/pool.rs @@ -360,8 +360,7 @@ mod tests { // If running concurrently, the overall time should be near 200ms (with some allowance). assert!( elapsed < Duration::from_millis(250), - "Elapsed time was too high: {:?}", - elapsed + "Elapsed time was too high: {elapsed:?}" ); } @@ -391,8 +390,7 @@ mod tests { // If running concurrently, the overall time should be near 200ms (with some allowance). assert!( elapsed < Duration::from_millis(250), - "Elapsed time was too high: {:?}", - elapsed + "Elapsed time was too high: {elapsed:?}" ); } diff --git a/tools/bench-buffer/src/main.rs b/tools/bench-buffer/src/main.rs index 3ccd6c3baab..ffea3cb6067 100644 --- a/tools/bench-buffer/src/main.rs +++ b/tools/bench-buffer/src/main.rs @@ -230,10 +230,8 @@ fn mock_envelope( let project_key = (rand::random::() * project_count as f64) as u128; let mut envelope = format!( "\ - {{\"event_id\":\"9ec79c33ec9942ab8353589fcb2e04dc\",\"dsn\":\"https://{:032x}:@sentry.io/42\"}}\n\ - {{\"type\":\"attachment\", \"length\":{}}}\n", - project_key, - payload_size, + {{\"event_id\":\"9ec79c33ec9942ab8353589fcb2e04dc\",\"dsn\":\"https://{project_key:032x}:@sentry.io/42\"}}\n\ + {{\"type\":\"attachment\", \"length\":{payload_size}}}\n", ).into_bytes(); // Fill with random bytes to get estimated compression ratio: diff --git a/tools/document-pii/src/item_collector.rs b/tools/document-pii/src/item_collector.rs index 3910cd3e6cf..1f28ca84990 100644 --- a/tools/document-pii/src/item_collector.rs +++ b/tools/document-pii/src/item_collector.rs @@ -154,7 +154,7 @@ fn normalize_type_path(mut path: String, crate_root: &str, module_path: &str) -> path = path .replace(' ', "") .replace('-', "_") - .replace("crate::", &format!("{}::", crate_root)); + .replace("crate::", &format!("{crate_root}::")); if path.contains("super::") { let parent_module = {