Skip to content

Commit 03fd8ea

Browse files
uninlined_format_args
1 parent d5b8889 commit 03fd8ea

File tree

21 files changed

+43
-56
lines changed

21 files changed

+43
-56
lines changed

relay-config/src/config.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2247,7 +2247,7 @@ impl Config {
22472247
}
22482248

22492249
let file_name = path.file_name().and_then(|f| f.to_str())?;
2250-
let new_file_name = format!("{}.{}", file_name, partition_id);
2250+
let new_file_name = format!("{file_name}.{partition_id}");
22512251
path.set_file_name(new_file_name);
22522252

22532253
Some(path)

relay-event-normalization/src/normalize/contexts.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ fn normalize_runtime_context(runtime: &mut RuntimeContext) {
145145
// The equivalent calculation is done in `sentry` in `src/sentry/interfaces/contexts.py`.
146146
if runtime.runtime.value().is_none() {
147147
if let (Some(name), Some(version)) = (runtime.name.value(), runtime.version.value()) {
148-
runtime.runtime = Annotated::from(format!("{} {}", name, version));
148+
runtime.runtime = Annotated::from(format!("{name} {version}"));
149149
}
150150
}
151151
}
@@ -270,7 +270,7 @@ fn compute_os_context(os: &mut OsContext) {
270270
// The equivalent calculation is done in `sentry` in `src/sentry/interfaces/contexts.py`.
271271
if os.os.value().is_none() {
272272
if let (Some(name), Some(version)) = (os.name.value(), os.version.value()) {
273-
os.os = Annotated::from(format!("{} {}", name, version));
273+
os.os = Annotated::from(format!("{name} {version}"));
274274
}
275275
}
276276
}
@@ -280,7 +280,7 @@ fn normalize_browser_context(browser: &mut BrowserContext) {
280280
// The equivalent calculation is done in `sentry` in `src/sentry/interfaces/contexts.py`.
281281
if browser.browser.value().is_none() {
282282
if let (Some(name), Some(version)) = (browser.name.value(), browser.version.value()) {
283-
browser.browser = Annotated::from(format!("{} {}", name, version));
283+
browser.browser = Annotated::from(format!("{name} {version}"));
284284
}
285285
}
286286
}

relay-event-normalization/src/normalize/span/description/mod.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1415,15 +1415,14 @@ mod tests {
14151415
for (url, allowed_hosts, expected) in examples {
14161416
let json = format!(
14171417
r#"{{
1418-
"description": "POST {}",
1418+
"description": "POST {url}",
14191419
"span_id": "bd2eb23da2beb459",
14201420
"start_timestamp": 1597976393.4619668,
14211421
"timestamp": 1597976393.4718769,
14221422
"trace_id": "ff62a8b040f340bda5d830223def1d81",
14231423
"op": "http.client"
14241424
}}
14251425
"#,
1426-
url,
14271426
);
14281427

14291428
let mut span = Annotated::<Span>::from_json(&json).unwrap();
@@ -1433,7 +1432,7 @@ mod tests {
14331432

14341433
assert_eq!(
14351434
scrubbed.0.as_deref(),
1436-
Some(format!("POST {}", expected).as_str()),
1435+
Some(format!("POST {expected}").as_str()),
14371436
"Could not match {url}"
14381437
);
14391438
}

relay-event-normalization/src/timestamp.rs

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -53,17 +53,15 @@ impl Processor for TimestampProcessor {
5353
if let Some(start_timestamp) = span.start_timestamp.value() {
5454
if start_timestamp.into_inner().timestamp_millis() < 0 {
5555
meta.add_error(Error::invalid(format!(
56-
"start_timestamp is too stale: {}",
57-
start_timestamp
56+
"start_timestamp is too stale: {start_timestamp}"
5857
)));
5958
return Err(ProcessingAction::DeleteValueHard);
6059
}
6160
}
6261
if let Some(end_timestamp) = span.timestamp.value() {
6362
if end_timestamp.into_inner().timestamp_millis() < 0 {
6463
meta.add_error(Error::invalid(format!(
65-
"timestamp is too stale: {}",
66-
end_timestamp
64+
"timestamp is too stale: {end_timestamp}"
6765
)));
6866
return Err(ProcessingAction::DeleteValueHard);
6967
}
@@ -81,8 +79,7 @@ impl Processor for TimestampProcessor {
8179
if let Some(timestamp) = breadcrumb.timestamp.value() {
8280
if timestamp.into_inner().timestamp_millis() < 0 {
8381
meta.add_error(Error::invalid(format!(
84-
"timestamp is too stale: {}",
85-
timestamp
82+
"timestamp is too stale: {timestamp}"
8683
)));
8784
return Err(ProcessingAction::DeleteValueHard);
8885
}

relay-event-schema/src/protocol/thread.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,8 @@ impl Empty for ThreadId {
7373
impl fmt::Display for ThreadId {
7474
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
7575
match self {
76-
ThreadId::Int(id) => write!(f, "{}", id),
77-
ThreadId::String(id) => write!(f, "{}", id),
76+
ThreadId::Int(id) => write!(f, "{id}"),
77+
ThreadId::String(id) => write!(f, "{id}"),
7878
}
7979
}
8080
}

relay-filter/src/transaction_name.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -247,8 +247,7 @@ mod tests {
247247
assert_eq!(
248248
filter_result,
249249
Ok(()),
250-
"Event filtered for event_type={} although filter should have not matched",
251-
event_type
250+
"Event filtered for event_type={event_type} although filter should have not matched"
252251
)
253252
}
254253
}

relay-log/src/setup.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ impl Level {
126126

127127
impl Display for Level {
128128
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
129-
write!(f, "{}", format!("{:?}", self).to_lowercase())
129+
write!(f, "{}", format!("{self:?}").to_lowercase())
130130
}
131131
}
132132

relay-profiling/src/sample/v2.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -221,10 +221,10 @@ mod tests {
221221
fn test_roundtrip() {
222222
let first_payload = include_bytes!("../../tests/fixtures/sample/v2/valid.json");
223223
let first_parse = parse(first_payload);
224-
assert!(first_parse.is_ok(), "{:#?}", first_parse);
224+
assert!(first_parse.is_ok(), "{first_parse:#?}");
225225
let second_payload = serde_json::to_vec(&first_parse.unwrap()).unwrap();
226226
let second_parse = parse(&second_payload[..]);
227-
assert!(second_parse.is_ok(), "{:#?}", second_parse);
227+
assert!(second_parse.is_ok(), "{second_parse:#?}");
228228
}
229229

230230
#[test]

relay-profiling/src/utils.rs

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,16 +31,13 @@ where
3131
AnyType::String(s) => s.parse::<T>().map_err(serde::de::Error::custom),
3232
AnyType::Number(n) => Ok(n),
3333
AnyType::Bool(v) => Err(serde::de::Error::custom(format!(
34-
"unsupported value: {:?}",
35-
v
34+
"unsupported value: {v:?}"
3635
))),
3736
AnyType::Array(v) => Err(serde::de::Error::custom(format!(
38-
"unsupported value: {:?}",
39-
v
37+
"unsupported value: {v:?}"
4038
))),
4139
AnyType::Object(v) => Err(serde::de::Error::custom(format!(
42-
"unsupported value: {:?}",
43-
v
40+
"unsupported value: {v:?}"
4441
))),
4542
AnyType::Null => Err(serde::de::Error::custom("unsupported null value")),
4643
}

relay-prosperoconv/build.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ fn main() {
4040
"clone",
4141
"git@github.com:getsentry/tempest.git",
4242
&temp_dir_str,
43-
&format!("--revision={}", version),
43+
&format!("--revision={version}"),
4444
"--depth=1",
4545
])
4646
.status()
@@ -52,7 +52,7 @@ fn main() {
5252
"clone",
5353
"https://github.com/getsentry/tempest.git",
5454
&temp_dir_str,
55-
&format!("--revision={}", version),
55+
&format!("--revision={version}"),
5656
"--depth=1",
5757
])
5858
.status()

relay-quotas/src/redis.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -493,7 +493,7 @@ mod tests {
493493
scope_id: None,
494494
limit: Some(quota_limit),
495495
window: Some(600),
496-
reason_code: Some(ReasonCode::new(format!("ns: {:?}", namespace))),
496+
reason_code: Some(ReasonCode::new(format!("ns: {namespace:?}"))),
497497
namespace,
498498
}
499499
};

relay-sampling/src/redis_sampling.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ pub struct ReservoirRuleKey(String);
88

99
impl ReservoirRuleKey {
1010
pub fn new(org_id: OrganizationId, rule_id: RuleId) -> Self {
11-
Self(format!("reservoir:{}:{}", org_id, rule_id))
11+
Self(format!("reservoir:{org_id}:{rule_id}"))
1212
}
1313

1414
fn as_str(&self) -> &str {

relay-server/benches/benches.rs

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -58,11 +58,10 @@ fn mock_envelope_with_project_key(project_key: &ProjectKey, size: &str) -> Box<E
5858

5959
let bytes = Bytes::from(format!(
6060
"\
61-
{{\"event_id\":\"9ec79c33ec9942ab8353589fcb2e04dc\",\"dsn\":\"https://{}:@sentry.io/42\"}}\n\
61+
{{\"event_id\":\"9ec79c33ec9942ab8353589fcb2e04dc\",\"dsn\":\"https://{project_key}:@sentry.io/42\"}}\n\
6262
{{\"type\":\"attachment\"}}\n\
63-
{}\n\
64-
",
65-
project_key, payload
63+
{payload}\n\
64+
"
6665
));
6766

6867
let mut envelope = Envelope::parse_bytes(bytes).unwrap();
@@ -88,7 +87,7 @@ fn benchmark_sqlite_envelope_stack(c: &mut Criterion) {
8887

8988
// Benchmark push operations
9089
group.bench_with_input(
91-
BenchmarkId::new(format!("push_{}", envelope_size), size),
90+
BenchmarkId::new(format!("push_{envelope_size}"), size),
9291
size,
9392
|b, &size| {
9493
b.iter_with_setup(
@@ -126,7 +125,7 @@ fn benchmark_sqlite_envelope_stack(c: &mut Criterion) {
126125

127126
// Benchmark pop operations
128127
group.bench_with_input(
129-
BenchmarkId::new(format!("pop_{}", envelope_size), size),
128+
BenchmarkId::new(format!("pop_{envelope_size}"), size),
130129
size,
131130
|b, &size| {
132131
b.iter_with_setup(
@@ -166,7 +165,7 @@ fn benchmark_sqlite_envelope_stack(c: &mut Criterion) {
166165

167166
// Benchmark mixed push and pop operations
168167
group.bench_with_input(
169-
BenchmarkId::new(format!("mixed_{}", envelope_size), size),
168+
BenchmarkId::new(format!("mixed_{envelope_size}"), size),
170169
size,
171170
|b, &size| {
172171
b.iter_with_setup(
@@ -245,7 +244,7 @@ fn benchmark_envelope_buffer(c: &mut Criterion) {
245244
b.iter_with_setup(
246245
|| {
247246
let project_keys: Vec<_> = (0..num_projects)
248-
.map(|i| ProjectKey::parse(&format!("{:#032x}", i)).unwrap())
247+
.map(|i| ProjectKey::parse(&format!("{i:#032x}")).unwrap())
249248
.collect();
250249

251250
let mut envelopes = vec![];
@@ -277,7 +276,7 @@ fn benchmark_envelope_buffer(c: &mut Criterion) {
277276
b.iter_with_setup(
278277
|| {
279278
let project_keys: Vec<_> = (0..num_projects)
280-
.map(|i| ProjectKey::parse(&format!("{:#032x}", i)).unwrap())
279+
.map(|i| ProjectKey::parse(&format!("{i:#032x}")).unwrap())
281280
.collect();
282281

283282
let mut envelopes = vec![];

relay-server/src/metrics_extraction/transactions/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2083,7 +2083,7 @@ mod tests {
20832083
),
20842084
] {
20852085
let config: TransactionMetricsConfig = serde_json::from_str(config_str).unwrap();
2086-
assert_eq!(config.deprecated1, expected_strategy, "{}", config_str);
2086+
assert_eq!(config.deprecated1, expected_strategy, "{config_str}");
20872087
}
20882088
}
20892089

relay-server/src/services/outcome.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,7 @@ impl fmt::Display for Outcome {
247247
Outcome::RateLimited(None) => write!(f, "rate limited"),
248248
Outcome::RateLimited(Some(reason)) => write!(f, "rate limited with reason {reason}"),
249249
#[cfg(feature = "processing")]
250-
Outcome::CardinalityLimited(id) => write!(f, "cardinality limited ({})", id),
250+
Outcome::CardinalityLimited(id) => write!(f, "cardinality limited ({id})"),
251251
Outcome::Invalid(DiscardReason::Internal) => write!(f, "internal error"),
252252
Outcome::Invalid(reason) => write!(f, "invalid data ({reason})"),
253253
Outcome::Abuse => write!(f, "abuse limit reached"),

relay-server/src/services/processor/span.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -328,12 +328,12 @@ mod tests {
328328
let attribute_value = |key: &str| -> String {
329329
match attributes
330330
.get(key)
331-
.unwrap_or_else(|| panic!("attribute {} missing", key))
331+
.unwrap_or_else(|| panic!("attribute {key} missing"))
332332
.to_owned()
333333
.value
334334
{
335335
Some(Value::StringValue(str)) => str,
336-
_ => panic!("attribute {} not a string", key),
336+
_ => panic!("attribute {key} not a string"),
337337
}
338338
};
339339
assert_eq!(

relay-spans/src/v2_to_v1.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -318,14 +318,14 @@ fn derive_http_description(attributes: &Attributes, kind: &Option<&SpanV2Kind>)
318318
let Some(url_path) = url_path else {
319319
return Some(description);
320320
};
321-
let base_description = format!("{} {}", http_method, url_path);
321+
let base_description = format!("{http_method} {url_path}");
322322

323323
// Check for GraphQL operations
324324
if let Some(graphql_ops) = attributes
325325
.get_value("sentry.graphql.operation")
326326
.and_then(|v| v.as_str())
327327
{
328-
return Some(format!("{} ({})", base_description, graphql_ops));
328+
return Some(format!("{base_description} ({graphql_ops})"));
329329
}
330330

331331
Some(base_description)

relay-threading/benches/pool.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ fn bench_pool_scaling(c: &mut Criterion) {
9494
// Test with different task counts
9595
for tasks in [100, 1000, 10000].iter() {
9696
group.bench_with_input(
97-
BenchmarkId::new(format!("threads_{}", threads), tasks),
97+
BenchmarkId::new(format!("threads_{threads}"), tasks),
9898
tasks,
9999
|b, &tasks| {
100100
b.to_async(&runtime).iter(|| run_benchmark(&pool, tasks));
@@ -117,7 +117,7 @@ fn bench_multi_threaded_spawn(c: &mut Criterion) {
117117
// Test with different task counts
118118
for tasks in [1000, 10000].iter() {
119119
group.bench_with_input(
120-
BenchmarkId::new(format!("spawn_threads_{}", spawn_threads), tasks),
120+
BenchmarkId::new(format!("spawn_threads_{spawn_threads}"), tasks),
121121
tasks,
122122
|b, &tasks| {
123123
b.to_async(&runtime).iter(|| async {

relay-threading/src/pool.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -360,8 +360,7 @@ mod tests {
360360
// If running concurrently, the overall time should be near 200ms (with some allowance).
361361
assert!(
362362
elapsed < Duration::from_millis(250),
363-
"Elapsed time was too high: {:?}",
364-
elapsed
363+
"Elapsed time was too high: {elapsed:?}"
365364
);
366365
}
367366

@@ -391,8 +390,7 @@ mod tests {
391390
// If running concurrently, the overall time should be near 200ms (with some allowance).
392391
assert!(
393392
elapsed < Duration::from_millis(250),
394-
"Elapsed time was too high: {:?}",
395-
elapsed
393+
"Elapsed time was too high: {elapsed:?}"
396394
);
397395
}
398396

tools/bench-buffer/src/main.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -230,10 +230,8 @@ fn mock_envelope(
230230
let project_key = (rand::random::<f64>() * project_count as f64) as u128;
231231
let mut envelope = format!(
232232
"\
233-
{{\"event_id\":\"9ec79c33ec9942ab8353589fcb2e04dc\",\"dsn\":\"https://{:032x}:@sentry.io/42\"}}\n\
234-
{{\"type\":\"attachment\", \"length\":{}}}\n",
235-
project_key,
236-
payload_size,
233+
{{\"event_id\":\"9ec79c33ec9942ab8353589fcb2e04dc\",\"dsn\":\"https://{project_key:032x}:@sentry.io/42\"}}\n\
234+
{{\"type\":\"attachment\", \"length\":{payload_size}}}\n",
237235
).into_bytes();
238236

239237
// Fill with random bytes to get estimated compression ratio:

tools/document-pii/src/item_collector.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ fn normalize_type_path(mut path: String, crate_root: &str, module_path: &str) ->
154154
path = path
155155
.replace(' ', "")
156156
.replace('-', "_")
157-
.replace("crate::", &format!("{}::", crate_root));
157+
.replace("crate::", &format!("{crate_root}::"));
158158

159159
if path.contains("super::") {
160160
let parent_module = {

0 commit comments

Comments
 (0)