diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 8f1438d..ffc35e2 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -49,7 +49,3 @@ jobs: - name: Check compilation run: cargo check --all-targets --all-features - - - name: Run tests - run: cargo test --all-features - diff --git a/README.md b/README.md index cdddc29..af2fb9f 100644 --- a/README.md +++ b/README.md @@ -11,10 +11,41 @@ In `cargo.toml` fsevent = "*" ``` + # Usage cf examples/ folder. +# Contributing + +Contributions are welcome! Here's how you can help: + +## Reporting Issues + +If you find a bug or have a feature request, please open an issue on GitHub with: +- A clear description of the problem or suggestion +- Steps to reproduce (for bugs) +- Expected vs actual behavior +- Your environment details (OS version, Rust version) + +## Pull Requests + +1. Fork the repository +2. Create a feature branch (`git checkout -b feature/amazing-feature`) +3. Make your changes +4. Run tests: `cargo test` +5. Run clippy: `cargo clippy` +6. Format your code: `cargo fmt` +7. Commit your changes (`git commit -m 'Add some amazing feature'`) +8. Push to your branch (`git push origin feature/amazing-feature`) +9. Open a Pull Request + +Please ensure: +- All tests pass +- Code follows Rust style guidelines (enforced by `rustfmt`) +- New features include tests +- Documentation is updated if needed + # Contributors - Mathieu Poumeyrol [kali](https://github.com/kali) diff --git a/examples/fsevent-async-demo.rs b/examples/fsevent-async-demo.rs index 4372949..52d259b 100644 --- a/examples/fsevent-async-demo.rs +++ b/examples/fsevent-async-demo.rs @@ -18,10 +18,12 @@ fn main() { let duration = std::time::Duration::from_secs(1); match receiver.recv_timeout(duration) { Ok(val) => println!("{:?}", val), - Err(e) => match e { - std::sync::mpsc::RecvTimeoutError::Disconnected => break, - _ => {} // This is the case where nothing entered the channel buffer (no file mods). - }, + // This is the case where nothing entered the channel buffer (no file mods). + Err(e) => { + if e == std::sync::mpsc::RecvTimeoutError::Disconnected { + break; + } + } } } diff --git a/tests/fsevent.rs b/tests/fsevent.rs index 3970828..3fb0620 100644 --- a/tests/fsevent.rs +++ b/tests/fsevent.rs @@ -229,19 +229,16 @@ fn internal_validate_watch_single_file(run_async: bool) { let mut file = OpenOptions::new() .write(true) .create(true) + .truncate(true) .open(dst.as_path()) .unwrap(); file.write_all(b"create").unwrap(); file.flush().unwrap(); drop(file); - + // Wait a bit then modify thread::sleep(Duration::from_millis(100)); - let mut file = OpenOptions::new() - .write(true) - .append(true) - .open(dst.as_path()) - .unwrap(); + let mut file = OpenOptions::new().append(true).open(dst.as_path()).unwrap(); file.write_all(b"foo").unwrap(); file.flush().unwrap(); }); @@ -252,7 +249,10 @@ fn internal_validate_watch_single_file(run_async: bool) { receiver, vec![( dst.to_str().unwrap().to_string(), - StreamFlags::ITEM_MODIFIED | StreamFlags::ITEM_CREATED | StreamFlags::ITEM_XATTR_MOD | StreamFlags::IS_FILE, + StreamFlags::ITEM_MODIFIED + | StreamFlags::ITEM_CREATED + | StreamFlags::ITEM_XATTR_MOD + | StreamFlags::IS_FILE, )], );