Skip to content

Commit

Permalink
refactor(derive): drop tokio dependency
Browse files Browse the repository at this point in the history
The references to 'tokio' in `async-dropper-derive` are in quoted
code, that crate is a proc macro that doesn't need tokio to run
(ie. to manipulate token streams).

Leaving it in as a dependency just means tokio would show up twice
in the dep graph, built once for `async-dropper-derive` (as a proc
macro dependency and unused), and once as a regular dependency.

Having it as a dependency of `async-dropper-derive` also doesn't
force users of the `derive` feature to have a dependency on tokio:
they can still have compile errors due to the `tokio` symbol not
being found if they don't _also_ depend on tokio in their crate,
just like how <https://docs.rs/tracing-test/latest/tracing_test/>
cannot force your crate to depend on `tracing` (even though its
macro expansion needs it).
  • Loading branch information
fasterthanlime authored and t3hmrman committed Sep 11, 2024
1 parent 9385174 commit 8c7b5a3
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions crates/async-dropper-derive/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ proc-macro = true

[features]
default = []
tokio = ["dep:tokio"]
tokio = []
async-std = ["dep:async-std"]

[dependencies]
Expand All @@ -26,7 +26,6 @@ async-trait.workspace = true
proc-macro2.workspace = true
quote.workspace = true
syn.workspace = true
tokio = { workspace = true, optional = true }

[package.metadata.docs.rs]
all-features = false
Expand Down

0 comments on commit 8c7b5a3

Please sign in to comment.