Skip to content

Commit feb3479

Browse files
authored
docs: don't state that tracing-futures is required (#1827)
Currently, the documentation states in a few places that the `tracing-futures` crate is required for asynchronous code to use `tracing`. This is no longer the case, as `tracing` provides the `Instrument` combinator for futures; `tracing-futures` is only needed for things defined in the `futures` crate, such as `Stream` and `Sink`. This branch updates the documentation so that it doesn't incorrectly state that `tracing-futures` is required.
1 parent ba9d869 commit feb3479

File tree

2 files changed

+3
-8
lines changed

2 files changed

+3
-8
lines changed

README.md

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -209,9 +209,6 @@ async fn write(stream: &mut TcpStream) -> io::Result<usize> {
209209
}
210210
```
211211

212-
The [`tracing-futures`] crate must be specified as a dependency to enable
213-
`async` support.
214-
215212
Special handling is needed for the general case of code using
216213
[`std::future::Future`][std-future] or blocks with `async`/`await`, as the
217214
following example _will not_ work:
@@ -250,10 +247,9 @@ Under the hood, the [`#[instrument]`][instrument] macro performs same the explic
250247
attachment that `Future::instrument` does.
251248

252249
[std-future]: https://doc.rust-lang.org/stable/std/future/trait.Future.html
253-
[`tracing-futures`]: https://docs.rs/tracing-futures
254250
[closing]: https://docs.rs/tracing/latest/tracing/span/index.html#closing-spans
255251
[`Future::instrument`]: https://docs.rs/tracing/latest/tracing/trait.Instrument.html#method.instrument
256-
[instrument]: https://docs.rs/tracing/0.1.11/tracing/attr.instrument.html
252+
[instrument]: https://docs.rs/tracing/latest/tracing/attr.instrument.html
257253

258254
## Supported Rust Versions
259255

tracing/README.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -210,9 +210,8 @@ conflicts when executables try to set the default later.
210210

211211
If you are instrumenting code that make use of
212212
[`std::future::Future`](https://doc.rust-lang.org/stable/std/future/trait.Future.html)
213-
or async/await, be sure to use the
214-
[`tracing-futures`](https://docs.rs/tracing-futures) crate. This is needed
215-
because the following example _will not_ work:
213+
or async/await, avoid using the `Span::enter` method. The following example
214+
_will not_ work:
216215

217216
```rust
218217
async {

0 commit comments

Comments
 (0)