Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Only enable the tokio features used by this crate #210

Merged
merged 1 commit into from
Mar 9, 2022

Conversation

edmorley
Copy link
Contributor

@edmorley edmorley commented Mar 6, 2022

Tokio offers the following features:
https://docs.rs/tokio/latest/tokio/#feature-flags

This removes the following unused Tokio features from dependencies:

  • fs: Since it's only used by examples/tests/doctests (so doesn't need to be in dependencies):
    https://github.com/fussybeaver/bollard/search?q=%22tokio%3A%3Afs%22
  • rt / rt-multi-thread: Since it's not used by bollard itself, and should be specified by end-users in their application (see authoring libraries). By activating rt-multi-thread by default, it means anyone not using the multi-thread runtime has to pay the dependency/compile time price for it regardless.

And removes the following from dev-dependencies:

  • time / net: Since they are already specified in dependencies, and it's not necessary to duplicate them in dev-dependencies as Cargo will perform feature unification.
  • rt: Since rt-multi-thread includes rt already.
  • io-std: Since it's not used by any examples/tests and isn't even one of the official top-level features anyway:
    https://docs.rs/tokio/latest/tokio/#feature-flags

Note: The full dependency tree/compile time reduction benefits of this change won't be realised until this hyperlocal change is picked up in the next hyperlocal release (which stops hyperlocal from pulling in too many tokio features):
softprops/hyperlocal#54

@fussybeaver
Copy link
Owner

Well spotted, please rebase and I'll merge.

Tokio offers the following features:
https://docs.rs/tokio/latest/tokio/#feature-flags

This removes the following unused Tokio features from `dependencies`:
- `fs`: Since it's only used by examples/tests/doctests:
   https://github.com/fussybeaver/bollard/search?q=%22tokio%3A%3Afs%22
- `rt` / `rt-multi-thread`: Since it's not used by bollard itself, and should be
   specified by end-users in their application. By activating `rt-multi-thread`
   by default, it means anyone not using the multi-thread runtime has to pay
   the dependency/compile time price for it regardless.

And the following from `dev-dependencies`:
- `time` / `net`: Since they are already specified in `dependencies`, and it's
   not necessary to duplicate them in `dev-dependencies` as Cargo will perform
   feature unification.
- `rt`: Since `rt-multi-thread` includes `rt` already.
- `io-std`: Since it's not used by any examples/tests and isn't even one
   of the official top-level features anyway:
   https://docs.rs/tokio/latest/tokio/#feature-flags

Note: The full benefits of this change won't be realised until this `hyperlocal`
change is picked up in the next `hyperlocal` release:
softprops/hyperlocal#54
@edmorley edmorley force-pushed the tokio-features-cleanup branch from a948b0c to 2adefd2 Compare March 8, 2022 17:40
@edmorley
Copy link
Contributor Author

edmorley commented Mar 8, 2022

Thank you, rebased :-)

@fussybeaver fussybeaver merged commit b75ffd3 into fussybeaver:master Mar 9, 2022
@edmorley edmorley deleted the tokio-features-cleanup branch March 9, 2022 10:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants