From 44dc9f5bfa6955e0fd498d58f3a59ca3e17317a0 Mon Sep 17 00:00:00 2001 From: Name1e5s <836401406@qq.com> Date: Sun, 20 Mar 2022 00:52:47 +0800 Subject: [PATCH] chore: remove unused dev-dependencies (#2005) ## Motivation Remove unused dev-dependencies, and update documentation examples to use `std::future`. --- tracing/Cargo.toml | 2 -- tracing/src/span.rs | 14 ++++++++------ 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/tracing/Cargo.toml b/tracing/Cargo.toml index c72f891c3a..8cdc29467c 100644 --- a/tracing/Cargo.toml +++ b/tracing/Cargo.toml @@ -38,10 +38,8 @@ cfg-if = "1.0.0" pin-project-lite = "0.2" [dev-dependencies] -futures = "0.1" criterion = { version = "0.3", default_features = false } log = "0.4" -tokio = { version = "0.2.21", features = ["rt-core"] } [target.'cfg(target_arch = "wasm32")'.dev-dependencies] wasm-bindgen-test = "^0.3" diff --git a/tracing/src/span.rs b/tracing/src/span.rs index d5923666c3..6ca7f886aa 100644 --- a/tracing/src/span.rs +++ b/tracing/src/span.rs @@ -182,26 +182,27 @@ //! _closed_. Consider, for example, a future which has an associated //! span and enters that span every time it is polled: //! ```rust -//! # use futures::{Future, Poll, Async}; +//! # use std::future::Future; +//! # use std::task::{Context, Poll}; +//! # use std::pin::Pin; //! struct MyFuture { //! // data //! span: tracing::Span, //! } //! //! impl Future for MyFuture { -//! type Item = (); -//! type Error = (); +//! type Output = (); //! -//! fn poll(&mut self) -> Poll { +//! fn poll(self: Pin<&mut Self>, _cx: &mut Context<'_>) -> Poll { //! let _enter = self.span.enter(); //! // Do actual future work... -//! # Ok(Async::Ready(())) +//! # Poll::Ready(()) //! } //! } //! ``` //! //! If this future was spawned on an executor, it might yield one or more times -//! before `poll` returns `Ok(Async::Ready)`. If the future were to yield, then +//! before `poll` returns [`Poll::Ready`]. If the future were to yield, then //! the executor would move on to poll the next future, which may _also_ enter //! an associated span or series of spans. Therefore, it is valid for a span to //! be entered repeatedly before it completes. Only the time when that span or @@ -283,6 +284,7 @@ //! [fields]: super::field //! [Metadata]: super::Metadata //! [verbosity level]: super::Level +//! [`Poll::Ready`]: std::task::Poll::Ready //! [`span!`]: super::span! //! [`trace_span!`]: super::trace_span! //! [`debug_span!`]: super::debug_span!