Skip to content

Commit 5e29598

Browse files
authored
chore: fix format lint (#3039)
1 parent af2f144 commit 5e29598

File tree

55 files changed

+186
-257
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+186
-257
lines changed

opentelemetry-appender-log/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -687,7 +687,7 @@ mod any_value {
687687
) -> Result<(), Self::Error> {
688688
let key = match key.serialize(ValueSerializer)? {
689689
Some(AnyValue::String(key)) => Key::from(String::from(key)),
690-
key => Key::from(format!("{:?}", key)),
690+
key => Key::from(format!("{key:?}")),
691691
};
692692

693693
self.key = Some(key);

opentelemetry-appender-tracing/benches/log-attributes.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ fn create_benchmark(c: &mut Criterion, num_attributes: usize) {
6060
let subscriber = Registry::default().with(ot_layer);
6161

6262
tracing::subscriber::with_default(subscriber, || {
63-
c.bench_function(&format!("otel_{}_attributes", num_attributes), |b| {
63+
c.bench_function(&format!("otel_{num_attributes}_attributes"), |b| {
6464
b.iter(|| {
6565
// Dynamically generate the error! macro call based on the number of attributes
6666
match num_attributes {

opentelemetry-appender-tracing/src/layer.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ impl<LR: LogRecord> tracing::field::Visit for EventVisitor<'_, LR> {
7373
return;
7474
}
7575
if field.name() == "message" {
76-
self.log_record.set_body(format!("{:?}", value).into());
76+
self.log_record.set_body(format!("{value:?}").into());
7777
} else {
7878
self.log_record
7979
.add_attribute(Key::new(field.name()), AnyValue::from(format!("{value:?}")));

opentelemetry-jaeger-propagator/src/propagator.rs

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -325,7 +325,7 @@ mod tests {
325325
true,
326326
TraceState::default(),
327327
),
328-
format!("{}:{}:0:1", LONG_TRACE_ID_STR, SPAN_ID_STR),
328+
format!("{LONG_TRACE_ID_STR}:{SPAN_ID_STR}:0:1"),
329329
),
330330
(
331331
SpanContext::new(
@@ -335,7 +335,7 @@ mod tests {
335335
true,
336336
TraceState::default(),
337337
),
338-
format!("{}:{}:0:0", LONG_TRACE_ID_STR, SPAN_ID_STR),
338+
format!("{LONG_TRACE_ID_STR}:{SPAN_ID_STR}:0:0"),
339339
),
340340
(
341341
SpanContext::new(
@@ -345,7 +345,7 @@ mod tests {
345345
true,
346346
TraceState::default(),
347347
),
348-
format!("{}:{}:0:3", LONG_TRACE_ID_STR, SPAN_ID_STR),
348+
format!("{LONG_TRACE_ID_STR}:{SPAN_ID_STR}:0:3"),
349349
),
350350
]
351351
}
@@ -356,7 +356,7 @@ mod tests {
356356
let propagator = Propagator::with_custom_header(construct_header);
357357
for (trace_id, span_id, flag, expected) in get_extract_data() {
358358
let mut map: HashMap<String, String> = HashMap::new();
359-
map.set(context_key, format!("{}:{}:0:{}", trace_id, span_id, flag));
359+
map.set(context_key, format!("{trace_id}:{span_id}:0:{flag}"));
360360
let context = propagator.extract(&map);
361361
assert_eq!(context.span().span_context(), &expected);
362362
}
@@ -392,7 +392,7 @@ mod tests {
392392

393393
// Propagators implement debug
394394
assert_eq!(
395-
format!("{:?}", default_propagator),
395+
format!("{default_propagator:?}"),
396396
format!(
397397
"Propagator {{ baggage_prefix: \"{}\", header_name: \"{}\", fields: [\"{}\"] }}",
398398
JAEGER_BAGGAGE_PREFIX, JAEGER_HEADER, JAEGER_HEADER
@@ -641,10 +641,7 @@ mod tests {
641641
}
642642
for (trace_id, span_id, flag, expected) in get_extract_data() {
643643
let mut map: HashMap<String, String> = HashMap::new();
644-
map.set(
645-
JAEGER_HEADER,
646-
format!("{}:{}:0:{}", trace_id, span_id, flag),
647-
);
644+
map.set(JAEGER_HEADER, format!("{trace_id}:{span_id}:0:{flag}"));
648645
let context = propagator.extract(&map);
649646
assert_eq!(context.span().span_context(), &expected);
650647
}
@@ -655,7 +652,7 @@ mod tests {
655652
let mut map: HashMap<String, String> = HashMap::new();
656653
map.set(
657654
JAEGER_HEADER,
658-
format!("{}:{}:0:1:aa", LONG_TRACE_ID_STR, SPAN_ID_STR),
655+
format!("{LONG_TRACE_ID_STR}:{SPAN_ID_STR}:0:1:aa"),
659656
);
660657
let propagator = Propagator::new();
661658
let context = propagator.extract(&map);
@@ -667,7 +664,7 @@ mod tests {
667664
let mut map: HashMap<String, String> = HashMap::new();
668665
map.set(
669666
JAEGER_HEADER,
670-
format!("{}:{}:0:aa", LONG_TRACE_ID_STR, SPAN_ID_STR),
667+
format!("{LONG_TRACE_ID_STR}:{SPAN_ID_STR}:0:aa"),
671668
);
672669
let propagator = Propagator::new();
673670
let context = propagator.extract(&map);
@@ -679,7 +676,7 @@ mod tests {
679676
let mut map: HashMap<String, String> = HashMap::new();
680677
map.set(
681678
JAEGER_HEADER,
682-
format!("{}%3A{}%3A0%3A1", LONG_TRACE_ID_STR, SPAN_ID_STR),
679+
format!("{LONG_TRACE_ID_STR}%3A{SPAN_ID_STR}%3A0%3A1"),
683680
);
684681
let propagator = Propagator::new();
685682
let context = propagator.extract(&map);

opentelemetry-otlp/examples/basic-otlp-http/src/main.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -169,15 +169,15 @@ async fn main() -> Result<(), Box<dyn Error + Send + Sync + 'static>> {
169169
// Collect all shutdown errors
170170
let mut shutdown_errors = Vec::new();
171171
if let Err(e) = tracer_provider.shutdown() {
172-
shutdown_errors.push(format!("tracer provider: {}", e));
172+
shutdown_errors.push(format!("tracer provider: {e}"));
173173
}
174174

175175
if let Err(e) = meter_provider.shutdown() {
176-
shutdown_errors.push(format!("meter provider: {}", e));
176+
shutdown_errors.push(format!("meter provider: {e}"));
177177
}
178178

179179
if let Err(e) = logger_provider.shutdown() {
180-
shutdown_errors.push(format!("logger provider: {}", e));
180+
shutdown_errors.push(format!("logger provider: {e}"));
181181
}
182182

183183
// Return an error if any shutdown failed

opentelemetry-otlp/examples/basic-otlp/src/main.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -162,15 +162,15 @@ async fn main() -> Result<(), Box<dyn Error + Send + Sync + 'static>> {
162162
// Collect all shutdown errors
163163
let mut shutdown_errors = Vec::new();
164164
if let Err(e) = tracer_provider.shutdown() {
165-
shutdown_errors.push(format!("tracer provider: {}", e));
165+
shutdown_errors.push(format!("tracer provider: {e}"));
166166
}
167167

168168
if let Err(e) = meter_provider.shutdown() {
169-
shutdown_errors.push(format!("meter provider: {}", e));
169+
shutdown_errors.push(format!("meter provider: {e}"));
170170
}
171171

172172
if let Err(e) = logger_provider.shutdown() {
173-
shutdown_errors.push(format!("logger provider: {}", e));
173+
shutdown_errors.push(format!("logger provider: {e}"));
174174
}
175175

176176
// Return an error if any shutdown failed

opentelemetry-otlp/src/exporter/http/logs.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ impl LogExporter for OtlpHttpClient {
1010
let client = self
1111
.client
1212
.lock()
13-
.map_err(|e| OTelSdkError::InternalFailure(format!("Mutex lock failed: {}", e)))?
13+
.map_err(|e| OTelSdkError::InternalFailure(format!("Mutex lock failed: {e}")))?
1414
.clone()
1515
.ok_or(OTelSdkError::AlreadyShutdown)?;
1616

@@ -53,7 +53,7 @@ impl LogExporter for OtlpHttpClient {
5353

5454
fn shutdown_with_timeout(&self, _timeout: time::Duration) -> OTelSdkResult {
5555
let mut client_guard = self.client.lock().map_err(|e| {
56-
OTelSdkError::InternalFailure(format!("Failed to acquire client lock: {}", e))
56+
OTelSdkError::InternalFailure(format!("Failed to acquire client lock: {e}"))
5757
})?;
5858

5959
if client_guard.take().is_none() {

opentelemetry-otlp/src/exporter/http/metrics.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ impl MetricsClient for OtlpHttpClient {
6262
fn shutdown(&self) -> OTelSdkResult {
6363
self.client
6464
.lock()
65-
.map_err(|e| OTelSdkError::InternalFailure(format!("Failed to acquire lock: {}", e)))?
65+
.map_err(|e| OTelSdkError::InternalFailure(format!("Failed to acquire lock: {e}")))?
6666
.take();
6767

6868
Ok(())

opentelemetry-otlp/src/exporter/http/mod.rs

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -615,17 +615,14 @@ mod tests {
615615
assert_eq!(
616616
headers.len(),
617617
expected_headers.len(),
618-
"Failed on input: {}",
619-
input_str
618+
"Failed on input: {input_str}"
620619
);
621620

622621
for (expected_key, expected_value) in expected_headers {
623622
assert_eq!(
624623
headers.get(&HeaderName::from_static(expected_key)),
625624
Some(&HeaderValue::from_static(expected_value)),
626-
"Failed on key: {} with input: {}",
627-
expected_key,
628-
input_str
625+
"Failed on key: {expected_key} with input: {input_str}"
629626
);
630627
}
631628
}
@@ -665,17 +662,14 @@ mod tests {
665662
assert_eq!(
666663
headers.len(),
667664
expected_headers.len(),
668-
"Failed on input: {}",
669-
input_str
665+
"Failed on input: {input_str}"
670666
);
671667

672668
for (expected_key, expected_value) in expected_headers {
673669
assert_eq!(
674670
headers.get(&HeaderName::from_static(expected_key)),
675671
Some(&HeaderValue::from_static(expected_value)),
676-
"Failed on key: {} with input: {}",
677-
expected_key,
678-
input_str
672+
"Failed on key: {expected_key} with input: {input_str}"
679673
);
680674
}
681675
}

opentelemetry-otlp/src/exporter/http/trace.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ impl SpanExporter for OtlpHttpClient {
1313
let client = match self
1414
.client
1515
.lock()
16-
.map_err(|e| OTelSdkError::InternalFailure(format!("Mutex lock failed: {}", e)))
16+
.map_err(|e| OTelSdkError::InternalFailure(format!("Mutex lock failed: {e}")))
1717
.and_then(|g| match &*g {
1818
Some(client) => Ok(Arc::clone(client)),
1919
_ => Err(OTelSdkError::AlreadyShutdown),
@@ -65,7 +65,7 @@ impl SpanExporter for OtlpHttpClient {
6565

6666
fn shutdown(&mut self) -> OTelSdkResult {
6767
let mut client_guard = self.client.lock().map_err(|e| {
68-
OTelSdkError::InternalFailure(format!("Failed to acquire client lock: {}", e))
68+
OTelSdkError::InternalFailure(format!("Failed to acquire client lock: {e}"))
6969
})?;
7070

7171
if client_guard.take().is_none() {

0 commit comments

Comments
 (0)