Formatting

This commit is contained in:
Félix Saparelli 2021-04-11 05:33:30 +12:00
parent f4637892ab
commit b5f56e831d
No known key found for this signature in database
GPG Key ID: B948C4BAE44FC474
3 changed files with 12 additions and 5 deletions

View File

@ -207,11 +207,15 @@ where
builder.ignores(ignores); builder.ignores(ignores);
if args.occurrences_of("poll") > 0 { if args.occurrences_of("poll") > 0 {
builder.poll_interval(Duration::from_millis(value_t!(args.value_of("poll"), u64).unwrap_or_else(|e| e.exit()))); builder.poll_interval(Duration::from_millis(
value_t!(args.value_of("poll"), u64).unwrap_or_else(|e| e.exit()),
));
} }
if args.occurrences_of("debounce") > 0 { if args.occurrences_of("debounce") > 0 {
builder.debounce(Duration::from_millis(value_t!(args.value_of("debounce"), u64).unwrap_or_else(|e| e.exit()))); builder.debounce(Duration::from_millis(
value_t!(args.value_of("debounce"), u64).unwrap_or_else(|e| e.exit()),
));
} }
builder.on_busy_update(if args.is_present("restart") { builder.on_busy_update(if args.is_present("restart") {

View File

@ -13,7 +13,7 @@
//! .expect("mission failed"); //! .expect("mission failed");
//! ``` //! ```
use std::{time::Duration, path::PathBuf}; use std::{path::PathBuf, time::Duration};
use crate::process::Shell; use crate::process::Shell;
use crate::run::OnBusyUpdate; use crate::run::OnBusyUpdate;

View File

@ -1,8 +1,8 @@
use notify::{raw_watcher, PollWatcher, RecommendedWatcher, RecursiveMode}; use notify::{raw_watcher, PollWatcher, RecommendedWatcher, RecursiveMode};
use std::convert::TryFrom; use std::convert::TryFrom;
use std::time::Duration;
use std::path::PathBuf; use std::path::PathBuf;
use std::sync::mpsc::Sender; use std::sync::mpsc::Sender;
use std::time::Duration;
/// Thin wrapper over the notify crate /// Thin wrapper over the notify crate
/// ///
@ -32,7 +32,10 @@ impl Watcher {
use notify::Watcher; use notify::Watcher;
let imp = if poll { let imp = if poll {
let mut watcher = PollWatcher::with_delay_ms(tx, u32::try_from(interval.as_millis()).unwrap_or(u32::MAX))?; let mut watcher = PollWatcher::with_delay_ms(
tx,
u32::try_from(interval.as_millis()).unwrap_or(u32::MAX),
)?;
for path in paths { for path in paths {
watcher.watch(path, RecursiveMode::Recursive)?; watcher.watch(path, RecursiveMode::Recursive)?;
debug!("Watching {:?}", path); debug!("Watching {:?}", path);