Formatting

This commit is contained in:
Félix Saparelli 2021-05-08 19:08:26 +12:00
parent 07f56ac7d5
commit 6aebd9b3e7
3 changed files with 13 additions and 16 deletions

View File

@ -4,7 +4,9 @@
//!
//! [Watchexec]: https://github.com/watchexec/watchexec
#![doc(html_favicon_url = "https://raw.githubusercontent.com/watchexec/watchexec/main/doc/logo.svg")]
#![doc(
html_favicon_url = "https://raw.githubusercontent.com/watchexec/watchexec/main/doc/logo.svg"
)]
#![doc(html_logo_url = "https://raw.githubusercontent.com/watchexec/watchexec/main/doc/logo.svg")]
#![warn(clippy::unwrap_used)]

View File

@ -2,9 +2,11 @@
use crate::error::Result;
use crate::pathop::PathOp;
use std::{collections::{HashMap, HashSet},
path::PathBuf,
process::Command};
use std::{
collections::{HashMap, HashSet},
path::PathBuf,
process::Command,
};
/// Shell to use to run commands.
///
@ -248,14 +250,11 @@ mod imp {
use crate::pathop::PathOp;
use crate::signal::Signal;
use std::{
convert::TryInto,
io::{self, Result},
mem,
os::windows::{io::IntoRawHandle, process::CommandExt},
ptr,
convert::TryInto,
os::windows::{
io::IntoRawHandle,
process::CommandExt,
},
};
use winapi::{
shared::{

View File

@ -101,20 +101,16 @@ where
let filter = NotificationFilter::new(&args.filters, &args.ignores, gitignore, ignore)?;
let (tx, rx) = channel();
let poll = args.poll;
#[cfg(target_os = "linux")]
let poll_interval = args.poll_interval;
#[cfg_attr(not(target_os = "linux"), allow(clippy::redundant_clone))]
#[cfg_attr(not(target_os = "linux"), allow(clippy::redundant_clone, unused_mut))]
let mut maybe_watcher = Watcher::new(tx.clone(), &paths, args.poll, args.poll_interval);
#[cfg(target_os = "linux")]
if !poll {
if !args.poll {
if let Err(notify::Error::Io(ref e)) = maybe_watcher {
if e.raw_os_error() == Some(nix::libc::ENOSPC) {
warn!("System notification limit is too small, falling back to polling mode. For better performance increase system limit:\n\tsysctl fs.inotify.max_user_watches=524288");
maybe_watcher = Watcher::new(tx, &paths, true, poll_interval);
maybe_watcher = Watcher::new(tx, &paths, true, args.poll_interval);
}
}
}