notify-rs / notify

🔭 Cross-platform filesystem notification library for Rust.
https://docs.rs/notify
2.77k stars 222 forks source link

`notify-debouncer-full` / `-mini` always enable `notify` default features #549

Closed LeoniePhiline closed 11 months ago

LeoniePhiline commented 1 year ago

System details

What you did (as detailed as you can)

  1. Create a new project.
  2. Add notify without default features. crossbeam-channel is not installed (as expected).
  3. Add notify-debouncer-full without default features.

What you expected

crossbeam-channel still not being installed, as default features are disabled for both notify and notify-debouncer-full.

What happened

crossbeam-channel is now installed despite the crossbeam default feature being disabled.

The reason is that notify-debouncer-full does not set default-features = false on its notify dependency.

Steps to reproduce

cargo init repro
cd repro

cargo add notify --no-default-features
cargo tree
# crossbeam-channel is not installed. Good.

cargo add notify-debouncer-full --no-default-features
cargo tree
# Unexpectedly, crossbeam-channel is now installed as dependency of `notify`.

Proposed fix

notify-debouncer-full/Cargo.toml:

 [features]
-default = ["crossbeam"]
+default = ["crossbeam","notify/macos_fsevent"]
 # can't use dep:crossbeam-channel and feature name crossbeam-channel below rust 1.60
 crossbeam = ["crossbeam-channel","notify/crossbeam-channel"]

 [dependencies]
-notify = { version = "6.1.1", path = "../notify" }
+notify = { version = "6.1.1", path = "../notify", default-features = false }

Note: The same applies to notify-debouncer-mini.