Skip to content

Commit

Permalink
Update to latest Rust
Browse files Browse the repository at this point in the history
Purposefully keep warnings as is. These reflect the changing landscape
of Rust pre-1.0, and will have to be fixed, as in not just silenced,
eventually.
  • Loading branch information
passcod committed Feb 2, 2015
1 parent e23bd7f commit 116af0c
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 18 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "notify"
version = "1.1.1"
version = "1.1.2"
authors = [
"F茅lix Saparelli <me@passcod.name>",
"Antti Ker盲nen <detegr@gmail.com>"
Expand Down
14 changes: 7 additions & 7 deletions src/inotify/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,20 @@ extern crate libc;

use self::inotify_sys::wrapper::{self, INotify, Watch};
use std::collections::HashMap;
use std::io::IoErrorKind;
use std::sync::{Arc, RWLock};
use std::old_io::IoErrorKind;
use std::old_io::fs::{PathExtensions, walk_dir};
use std::sync::mpsc::Sender;
use std::sync::{Arc, RwLock};
use std::thread::Thread;
use super::{Error, Event, op, Op, Watcher};
use std::io::fs::{PathExtensions, walk_dir};

mod flags;

pub struct INotifyWatcher {
inotify: INotify,
tx: Sender<Event>,
watches: HashMap<Path, (Watch, flags::Mask)>,
paths: Arc<RWLock<HashMap<Watch, Path>>>
paths: Arc<RwLock<HashMap<Watch, Path>>>
}

impl INotifyWatcher {
Expand Down Expand Up @@ -45,7 +45,7 @@ impl INotifyWatcher {
}
}
}
}).detach();
});
}

fn add_watch(&mut self, path: &Path) -> Result<(), Error> {
Expand Down Expand Up @@ -78,7 +78,7 @@ impl INotifyWatcher {
}

#[inline]
fn handle_event(event: wrapper::Event, tx: &Sender<Event>, paths: &Arc<RWLock<HashMap<Watch, Path>>>) {
fn handle_event(event: wrapper::Event, tx: &Sender<Event>, paths: &Arc<RwLock<HashMap<Watch, Path>>>) {
let mut o = Op::empty();
if event.is_create() || event.is_moved_to() {
o.insert(op::CREATE);
Expand Down Expand Up @@ -119,7 +119,7 @@ impl Watcher for INotifyWatcher {
inotify: i,
tx: tx,
watches: HashMap::new(), // TODO: use bimap?
paths: Arc::new(RWLock::new(HashMap::new()))
paths: Arc::new(RwLock::new(HashMap::new()))
},
Err(e) => return Err(Error::Io(e))
};
Expand Down
6 changes: 3 additions & 3 deletions src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#![feature(phase)]
#[phase(plugin, link)] extern crate log;
#[macro_use] extern crate log;
#[macro_use] extern crate rustc_bitflags;

use std::io::IoError;
use std::old_io::IoError;
use std::sync::mpsc::Sender;
#[cfg(test)] use std::sync::mpsc::channel;
pub use self::op::Op;
Expand Down
14 changes: 7 additions & 7 deletions src/poll.rs
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
use std::collections::{HashMap, HashSet};
use std::io::fs::{self, PathExtensions};
use std::sync::{Arc, RWLock};
use std::old_io::fs::{self, PathExtensions};
use std::sync::{Arc, RwLock};
use std::sync::mpsc::Sender;
use std::thread::Thread;
use super::{Error, Event, op, Watcher};

pub struct PollWatcher {
tx: Sender<Event>,
watches: Arc<RWLock<HashSet<Path>>>,
open: Arc<RWLock<bool>>
watches: Arc<RwLock<HashSet<Path>>>,
open: Arc<RwLock<bool>>
}

impl PollWatcher {
Expand Down Expand Up @@ -102,16 +102,16 @@ impl PollWatcher {
}
}
}
}).detach();
});
}
}

impl Watcher for PollWatcher {
fn new(tx: Sender<Event>) -> Result<PollWatcher, Error> {
let mut p = PollWatcher {
tx: tx,
watches: Arc::new(RWLock::new(HashSet::new())),
open: Arc::new(RWLock::new(true))
watches: Arc::new(RwLock::new(HashSet::new())),
open: Arc::new(RwLock::new(true))
};
p.run();
Ok(p)
Expand Down

0 comments on commit 116af0c

Please sign in to comment.