Skip to content

Commit 5912203

Browse files
authored
chore: cargo +nightly clippy --fix (#833)
1 parent be2e04e commit 5912203

File tree

9 files changed

+15
-16
lines changed

9 files changed

+15
-16
lines changed

sentry-core/src/performance.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -313,7 +313,7 @@ impl TransactionContext {
313313

314314
// And set our key
315315
let existing_value = custom.insert(key, value);
316-
std::mem::swap(&mut self.custom, &mut Some(custom));
316+
self.custom = Some(custom);
317317
existing_value
318318
}
319319

sentry-opentelemetry/src/converters.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ pub(crate) fn convert_span_status(status: &opentelemetry::trace::Status) -> Span
1818
}
1919

2020
pub(crate) fn convert_span_kind(kind: opentelemetry::trace::SpanKind) -> Value {
21-
format!("{:?}", kind).to_lowercase().into()
21+
format!("{kind:?}").to_lowercase().into()
2222
}
2323

2424
pub(crate) fn convert_value(value: opentelemetry::Value) -> Value {

sentry-opentelemetry/tests/captures_transaction.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,6 @@ fn test_captures_transaction() {
3737
sentry::protocol::EnvelopeItem::Transaction(tx) => {
3838
assert_eq!(tx.name.as_deref(), Some("root_span"));
3939
}
40-
unexpected => panic!("Expected transaction, but got {:#?}", unexpected),
40+
unexpected => panic!("Expected transaction, but got {unexpected:#?}"),
4141
}
4242
}

sentry-opentelemetry/tests/captures_transaction_with_nested_spans.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,6 @@ fn test_captures_transaction_with_nested_spans() {
6767
assert_eq!(grandchild_span.parent_span_id, Some(child_span.span_id));
6868
assert_eq!(child_span.parent_span_id, Some(tx_span_id));
6969
}
70-
unexpected => panic!("Expected transaction, but got {:#?}", unexpected),
70+
unexpected => panic!("Expected transaction, but got {unexpected:#?}"),
7171
}
7272
}

sentry-opentelemetry/tests/creates_distributed_trace.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,14 +63,14 @@ fn test_creates_distributed_trace() {
6363
for envelope in &envelopes {
6464
let tx = match envelope.items().next().unwrap() {
6565
sentry::protocol::EnvelopeItem::Transaction(tx) => tx.clone(),
66-
unexpected => panic!("Expected transaction, but got {:#?}", unexpected),
66+
unexpected => panic!("Expected transaction, but got {unexpected:#?}"),
6767
};
6868

6969
// Determine which service this transaction belongs to based on name
7070
match tx.name.as_deref() {
7171
Some("first_service") => first_tx = Some(tx),
7272
Some("second_service") => second_tx = Some(tx),
73-
name => panic!("Unexpected transaction name: {:?}", name),
73+
name => panic!("Unexpected transaction name: {name:?}"),
7474
}
7575
}
7676

sentry-tracing/src/converters.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,15 +77,15 @@ where
7777
TransactionOrSpan::Span(span) => {
7878
for (key, value) in span.data().iter() {
7979
if key != "message" {
80-
let key = format!("{}:{}", name, key);
80+
let key = format!("{name}:{key}");
8181
visitor.json_values.insert(key, value.clone());
8282
}
8383
}
8484
}
8585
TransactionOrSpan::Transaction(transaction) => {
8686
for (key, value) in transaction.data().iter() {
8787
if key != "message" {
88-
let key = format!("{}:{}", name, key);
88+
let key = format!("{name}:{key}");
8989
visitor.json_values.insert(key, value.clone());
9090
}
9191
}

sentry-tracing/tests/breadcrumbs.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ fn breadcrumbs_should_capture_span_fields() {
1212
let event = data.first().expect("should have 1 event");
1313
let event = match event.items().next().unwrap() {
1414
sentry::protocol::EnvelopeItem::Event(event) => event,
15-
unexpected => panic!("Expected event, but got {:#?}", unexpected),
15+
unexpected => panic!("Expected event, but got {unexpected:#?}"),
1616
};
1717

1818
assert_eq!(event.breadcrumbs.len(), 1);

sentry-tracing/tests/smoke.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,21 +16,21 @@ fn should_instrument_function_with_event() {
1616
let event = data.first().expect("should have 1 event");
1717
let event = match event.items().next().unwrap() {
1818
sentry::protocol::EnvelopeItem::Event(event) => event,
19-
unexpected => panic!("Expected event, but got {:#?}", unexpected),
19+
unexpected => panic!("Expected event, but got {unexpected:#?}"),
2020
};
2121

2222
//Validate transaction is created
2323
let trace = match event.contexts.get("trace").expect("to get 'trace' context") {
2424
sentry::protocol::Context::Trace(trace) => trace,
25-
unexpected => panic!("Expected trace context but got {:?}", unexpected),
25+
unexpected => panic!("Expected trace context but got {unexpected:?}"),
2626
};
2727
assert_eq!(trace.op.as_deref().unwrap(), "function_with_tags");
2828

2929
//Confirm transaction values
3030
let transaction = data.get(1).expect("should have 1 transaction");
3131
let transaction = match transaction.items().next().unwrap() {
3232
sentry::protocol::EnvelopeItem::Transaction(transaction) => transaction,
33-
unexpected => panic!("Expected transaction, but got {:#?}", unexpected),
33+
unexpected => panic!("Expected transaction, but got {unexpected:#?}"),
3434
};
3535
assert_eq!(transaction.tags.len(), 1);
3636
assert_eq!(trace.data.len(), 2);

sentry-types/src/protocol/v7.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1370,7 +1370,7 @@ impl fmt::Display for SpanId {
13701370

13711371
impl fmt::Debug for SpanId {
13721372
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
1373-
write!(fmt, "SpanId({})", self)
1373+
write!(fmt, "SpanId({self})")
13741374
}
13751375
}
13761376

@@ -1423,7 +1423,7 @@ impl fmt::Display for TraceId {
14231423

14241424
impl fmt::Debug for TraceId {
14251425
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
1426-
write!(fmt, "TraceId({})", self)
1426+
write!(fmt, "TraceId({self})")
14271427
}
14281428
}
14291429

@@ -2320,8 +2320,7 @@ impl<'de> Deserialize<'de> for LogAttribute {
23202320
}
23212321
_ => {
23222322
return Err(de::Error::custom(format!(
2323-
"expected type to be 'string' | 'integer' | 'double' | 'boolean', found {}",
2324-
type_str
2323+
"expected type to be 'string' | 'integer' | 'double' | 'boolean', found {type_str}"
23252324
)))
23262325
}
23272326
}

0 commit comments

Comments
 (0)