Skip to content

Commit 2e2937e

Browse files
committed
cleanup
1 parent cf4f15c commit 2e2937e

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

opentelemetry-sdk/src/runtime.rs

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
//! [Tokio]: https://crates.io/crates/tokio
77
//! [async-std]: https://crates.io/crates/async-std
88
9-
use std::{fmt::Debug, future::Future, time::Duration};
109
use futures_util::stream::{unfold, Stream};
10+
use std::{fmt::Debug, future::Future, time::Duration};
1111
use thiserror::Error;
1212

1313
/// A runtime is an abstraction of an async runtime like [Tokio] or [async-std]. It allows
@@ -34,15 +34,20 @@ pub trait Runtime: Clone + Send + Sync + 'static {
3434
/// At the moment, the shutdown happens by blocking the
3535
/// current thread. This means runtime implementations need to make sure they can still execute
3636
/// the given future even if the main thread is blocked.
37-
fn spawn<F>(&self, future: F) where F: Future<Output = ()> + Send + 'static;
37+
fn spawn<F>(&self, future: F)
38+
where
39+
F: Future<Output = ()> + Send + 'static;
3840

3941
/// Return a future that resolves after the specified [Duration].
4042
fn delay(&self, duration: Duration) -> impl Future<Output = ()> + Send + 'static;
4143
}
4244

4345
/// Uses the given runtime to produce an interval stream.
4446
#[cfg(feature = "experimental_async_runtime")]
45-
pub(crate) fn to_interval_stream<T: Runtime>(runtime: T, interval: Duration) -> impl Stream<Item = ()> {
47+
pub(crate) fn to_interval_stream<T: Runtime>(
48+
runtime: T,
49+
interval: Duration,
50+
) -> impl Stream<Item = ()> {
4651
unfold((), move |_| {
4752
let runtime_cloned = runtime.clone();
4853

@@ -70,7 +75,7 @@ pub struct Tokio;
7075
impl Runtime for Tokio {
7176
fn spawn<F>(&self, future: F)
7277
where
73-
F: Future<Output = ()> + Send + 'static
78+
F: Future<Output = ()> + Send + 'static,
7479
{
7580
#[allow(clippy::let_underscore_future)]
7681
// we don't have to await on the returned future to execute
@@ -111,7 +116,7 @@ pub struct TokioCurrentThread;
111116
impl Runtime for TokioCurrentThread {
112117
fn spawn<F>(&self, future: F)
113118
where
114-
F: Future<Output = ()> + Send + 'static
119+
F: Future<Output = ()> + Send + 'static,
115120
{
116121
// We cannot force push tracing in current thread tokio scheduler because we rely on
117122
// BatchSpanProcessor to export spans in a background task, meanwhile we need to block the
@@ -150,7 +155,7 @@ pub struct AsyncStd;
150155
impl Runtime for AsyncStd {
151156
fn spawn<F>(&self, future: F)
152157
where
153-
F: Future<Output = ()> + Send + 'static
158+
F: Future<Output = ()> + Send + 'static,
154159
{
155160
#[allow(clippy::let_underscore_future)]
156161
let _ = async_std::task::spawn(future);

0 commit comments

Comments
 (0)