From 5e6da23677fd780093a745e8f4a302b8b8486dd0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jorge=20Israel=20Pe=C3=B1a?= Date: Fri, 8 May 2015 12:36:32 -0700 Subject: [PATCH 1/2] use crates.io bitflags --- Cargo.toml | 1 + src/lib.rs | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index ce9b35e8..fe99f7cc 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -23,6 +23,7 @@ keywords = [ [dependencies] time = "*" +bitflags = "*" [target.x86_64-unknown-linux-gnu.dependencies.inotify] version = "^0.1" diff --git a/src/lib.rs b/src/lib.rs index ae9a5378..3750fe6b 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,7 +1,7 @@ #![feature(rustc_private, libc, fs_time, fs_walk, path_ext)] #[macro_use] extern crate log; -#[macro_use] extern crate rustc_bitflags; +#[macro_use] extern crate bitflags; use std::sync::mpsc::Sender; #[cfg(test)] use std::sync::mpsc::channel; From 32faa2ef5b5ef8aef50d5d2efb4cd6212e0c504e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jorge=20Israel=20Pe=C3=B1a?= Date: Fri, 8 May 2015 12:36:58 -0700 Subject: [PATCH 2/2] remove workarounds; fix made it into rustc --- src/inotify/mod.rs | 5 +---- src/poll.rs | 8 +------- 2 files changed, 2 insertions(+), 11 deletions(-) diff --git a/src/inotify/mod.rs b/src/inotify/mod.rs index ebbc8da9..317ef41a 100644 --- a/src/inotify/mod.rs +++ b/src/inotify/mod.rs @@ -151,10 +151,7 @@ impl Watcher for INotifyWatcher { } fn unwatch(&mut self, path: &Path) -> Result<(), Error> { - // FIXME: - // once https://github.com/rust-lang/rust/pull/22351 gets merged, - // just use a &Path - match self.watches.remove(&path.to_path_buf()) { + match self.watches.remove(path) { None => Err(Error::WatchNotFound), Some(p) => { let w = &p.0; diff --git a/src/poll.rs b/src/poll.rs index 4cdd7160..5f1bcee5 100644 --- a/src/poll.rs +++ b/src/poll.rs @@ -131,18 +131,12 @@ impl Watcher for PollWatcher { } fn watch(&mut self, path: &Path) -> Result<(), Error> { - // FIXME: - // once https://github.com/rust-lang/rust/pull/22351 gets merged, - // just use a &Path (*self.watches).write().unwrap().insert(path.to_path_buf()); Ok(()) } fn unwatch(&mut self, path: &Path) -> Result<(), Error> { - // FIXME: - // once https://github.com/rust-lang/rust/pull/22351 gets merged, - // just use a &Path - if (*self.watches).write().unwrap().remove(&path.to_path_buf()) { + if (*self.watches).write().unwrap().remove(path) { Ok(()) } else { Err(Error::WatchNotFound)