Skip to content

Commit b51373c

Browse files
authored
Merge pull request #35 from musicinmybrain/inotify-0.11
Update inotify dependency from 0.10.0 to 0.11.0
2 parents eff3598 + 31a8079 commit b51373c

File tree

5 files changed

+11
-24
lines changed

5 files changed

+11
-24
lines changed

Cargo.lock

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ anyhow = "1.0.65"
2323
cfg-if = "1.0.0"
2424

2525
[target.'cfg(target_os = "linux")'.dependencies]
26-
inotify = "0.10.0" # Watch files and auto-reload on changes
26+
inotify = "0.11.0" # Watch files and auto-reload on changes
2727

2828
[target.'cfg(any(target_os="macos", target_os="dragonfly", target_os="freebsd", target_os="netbsd", target_os="openbsd"))'.dependencies]
2929
kqueue = "1.0.6" # Watch files and auto-reload on changes

src/file_watcher/inotify.rs

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,7 @@ pub struct FileWatchImpl {
1616

1717
impl FileWatcherImpl {
1818
pub fn init() -> Result<FileWatcherImpl> {
19-
let ino = match Inotify::init() {
20-
Ok(i) => i,
21-
Err(msg) => return Result::Err(msg),
22-
};
19+
let ino = Inotify::init()?;
2320

2421
Result::Ok(FileWatcherImpl {
2522
inotify: ino,
@@ -30,15 +27,11 @@ impl FileWatcherImpl {
3027
pub fn add_watch(&mut self, file_path: &PathBuf) -> Result<&FileWatchImpl> {
3128
let mask: inotify::WatchMask = inotify::WatchMask::MODIFY;
3229

33-
let watch = match self.inotify.watches().add(file_path, mask) {
34-
Ok(w) => w,
35-
Err(msg) => return Result::Err(msg),
36-
};
37-
30+
let watch = self.inotify.watches().add(file_path, mask)?;
3831
let fw = FileWatchImpl { descriptor: watch };
3932

4033
self.watches.push(fw);
41-
return Result::Ok(self.watches.last().unwrap());
34+
Result::Ok(self.watches.last().unwrap())
4235
}
4336

4437
pub fn rm_watch(&mut self, fw: &FileWatchImpl) -> Result<()> {
@@ -62,10 +55,7 @@ impl FileWatcherImpl {
6255

6356
pub fn any_events(&mut self) -> Result<bool> {
6457
let mut buffer = [0; 1024];
65-
let events = match self.inotify.read_events(&mut buffer) {
66-
Result::Ok(ev) => ev,
67-
Result::Err(err) => return Result::Err(err),
68-
};
58+
let events = self.inotify.read_events(&mut buffer)?;
6959

7060
Result::Ok(events.count() > 0)
7161
}

src/file_watcher/kqueue.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,7 @@ pub struct FileWatchImpl {
2020

2121
impl FileWatcherImpl {
2222
pub fn init() -> Result<FileWatcherImpl> {
23-
let kq = match KQueue::new() {
24-
Ok(value) => value,
25-
Err(msg) => return Result::Err(msg),
26-
};
23+
let kq = KQueue::new()?;
2724

2825
Ok(FileWatcherImpl {
2926
kq,

src/ui/tui.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -340,7 +340,7 @@ impl<'a> Tui<'a> {
340340
}
341341
}
342342

343-
impl<'a> UiAgent for Tui<'a> {
343+
impl UiAgent for Tui<'_> {
344344
fn start(mut self) -> Result<ApplicationExitReason> {
345345
// Setup event loop and input handling
346346
let (tx, rx) = mpsc::channel();

0 commit comments

Comments
 (0)