Skip to content

Commit 664703c

Browse files
authored
Resolve new nightly clippy lints (#409)
1 parent e8c1c02 commit 664703c

File tree

3 files changed

+25
-17
lines changed

3 files changed

+25
-17
lines changed

opentelemetry/src/sdk/metrics/aggregators/ddsketch.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -878,7 +878,7 @@ mod tests {
878878
store.add(i)
879879
}
880880
assert_eq!(store.count, 1400);
881-
assert_eq!(store.bins.len(), 200 as usize);
881+
assert_eq!(store.bins.len(), 200);
882882
}
883883

884884
/// Test to see if copy_from_slice will panic because the range size is different in left and right

opentelemetry/src/sdk/trace/span_processor.rs

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -642,8 +642,10 @@ mod tests {
642642
#[tokio::test]
643643
async fn test_batch_span_processor() {
644644
let (exporter, mut export_receiver, _shutdown_receiver) = new_tokio_test_exporter();
645-
let mut config = BatchConfig::default();
646-
config.scheduled_delay = Duration::from_secs(60 * 60 * 24); // set the tick to 24 hours so we know the span must be exported via force_flush
645+
let config = BatchConfig {
646+
scheduled_delay: Duration::from_secs(60 * 60 * 24), // set the tick to 24 hours so we know the span must be exported via force_flush
647+
..Default::default()
648+
};
647649
let spawn = |fut| tokio::task::spawn_blocking(|| futures::executor::block_on(fut));
648650
let mut processor = BatchSpanProcessor::new(
649651
Box::new(exporter),
@@ -740,9 +742,11 @@ mod tests {
740742
// otherwise the exporter should be able to export within time out duration.
741743
#[cfg(feature = "async-std")]
742744
async fn timeout_test_std_async(time_out: bool) {
743-
let mut config = BatchConfig::default();
744-
config.max_export_timeout = time::Duration::from_millis(if time_out { 5 } else { 60 });
745-
config.scheduled_delay = Duration::from_secs(60 * 60 * 24); // set the tick to 24 hours so we know the span must be exported via force_flush
745+
let config = BatchConfig {
746+
max_export_timeout: time::Duration::from_millis(if time_out { 5 } else { 60 }),
747+
scheduled_delay: Duration::from_secs(60 * 60 * 24), // set the tick to 24 hours so we know the span must be exported via force_flush
748+
..Default::default()
749+
};
746750
let exporter = BlockingExporter {
747751
delay_for: time::Duration::from_millis(if !time_out { 5 } else { 60 }),
748752
delay_fn: async_std::task::sleep,
@@ -768,9 +772,11 @@ mod tests {
768772
// If the time_out is true, then the result suppose to ended with timeout.
769773
// otherwise the exporter should be able to export within time out duration.
770774
async fn timeout_test_tokio(time_out: bool) {
771-
let mut config = BatchConfig::default();
772-
config.max_export_timeout = time::Duration::from_millis(if time_out { 5 } else { 60 });
773-
config.scheduled_delay = Duration::from_secs(60 * 60 * 24); // set the tick to 24 hours so we know the span must be exported via force_flush
775+
let config = BatchConfig {
776+
max_export_timeout: time::Duration::from_millis(if time_out { 5 } else { 60 }),
777+
scheduled_delay: Duration::from_secs(60 * 60 * 24), // set the tick to 24 hours so we know the span must be exported via force_flush,
778+
..Default::default()
779+
};
774780
let exporter = BlockingExporter {
775781
delay_for: time::Duration::from_millis(if !time_out { 5 } else { 60 }),
776782
delay_fn: tokio::time::delay_for,

opentelemetry/src/sdk/trace/tracer.rs

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -352,14 +352,16 @@ mod tests {
352352
.build();
353353
let tracer = tracer_provider.get_tracer("test", None);
354354
let trace_state = TraceState::from_key_value(vec![("foo", "bar")]).unwrap();
355-
let mut span_builder = SpanBuilder::default();
356-
span_builder.parent_context = Some(Context::current_with_span(TestSpan(SpanContext::new(
357-
TraceId::from_u128(128),
358-
SpanId::from_u64(64),
359-
TRACE_FLAG_SAMPLED,
360-
true,
361-
trace_state,
362-
))));
355+
let span_builder = SpanBuilder {
356+
parent_context: Some(Context::current_with_span(TestSpan(SpanContext::new(
357+
TraceId::from_u128(128),
358+
SpanId::from_u64(64),
359+
TRACE_FLAG_SAMPLED,
360+
true,
361+
trace_state,
362+
)))),
363+
..Default::default()
364+
};
363365

364366
// Test sampler should change trace state
365367
let span = tracer.build(span_builder);

0 commit comments

Comments
 (0)