-
Notifications
You must be signed in to change notification settings - Fork 744
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
subscriber: Stop using prelude imports in doctests (#1422)
## Motivation I dislike using `*` imports in my code, so I'm not using prelude modules provided by libraries. With the way the examples in the `tracing-subscriber` docs are currently set up, there is no hint on where some methods are coming from. Just removing the prelude import unfortunately doesn't lead to a solution. The compiler prefers the prelude re-export: ``` = help: items from traits can only be used if the trait is in scope help: the following trait is implemented but not in scope; perhaps add a `use` for it: | 3 | use crate::tracing_subscriber::prelude::__tracing_subscriber_SubscriberExt; | ``` ## Solution Use the traits directly in the documentation examples. Since the compiler hints around this are currently very bad, it's good to have a hint where methods in doc examples could come from in there, for users who prefer not using the prelude.
- Loading branch information
Showing
5 changed files
with
13 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters