From f38e7ab9697269f2b756325fe88e38388ddd4191 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fe=CC=81lix=20Saparelli?= Date: Sat, 4 Jul 2020 00:20:02 +1200 Subject: [PATCH] Cargo fmt --- src/error.rs | 20 +++++++++----------- src/gitignore.rs | 2 +- src/process.rs | 21 ++++++++++++++++++--- src/run.rs | 14 ++++++++++++-- 4 files changed, 40 insertions(+), 17 deletions(-) diff --git a/src/error.rs b/src/error.rs index 1986948..949f557 100644 --- a/src/error.rs +++ b/src/error.rs @@ -33,18 +33,16 @@ impl From for Error { impl From for Error { fn from(err: io::Error) -> Self { - Self::Io( - match err.raw_os_error() { - Some(os_err) => match os_err { - 7 => { - let msg = "There are so many changed files that the environment variables of the child process have been overrun. Try running with --no-meta or --no-environment."; - io::Error::new(io::ErrorKind::Other, msg) - }, - _ => err, + Self::Io(match err.raw_os_error() { + Some(os_err) => match os_err { + 7 => { + let msg = "There are so many changed files that the environment variables of the child process have been overrun. Try running with --no-meta or --no-environment."; + io::Error::new(io::ErrorKind::Other, msg) } - None => err, - } - ) + _ => err, + }, + None => err, + }) } } diff --git a/src/gitignore.rs b/src/gitignore.rs index a67185a..44ebbe3 100644 --- a/src/gitignore.rs +++ b/src/gitignore.rs @@ -1,10 +1,10 @@ use globset::{GlobBuilder, GlobSet, GlobSetBuilder}; +use std::borrow::ToOwned; use std::fs; use std::io; use std::io::Read; use std::path::{Path, PathBuf}; -use std::borrow::{ToOwned}; use walkdir::WalkDir; pub struct Gitignore { diff --git a/src/process.rs b/src/process.rs index 41d72af..f3ae343 100644 --- a/src/process.rs +++ b/src/process.rs @@ -5,7 +5,12 @@ use crate::pathop::PathOp; use std::collections::{HashMap, HashSet}; use std::path::PathBuf; -pub fn spawn(cmd: &[String], updated_paths: &[PathOp], no_shell: bool, no_environment: bool) -> Result { +pub fn spawn( + cmd: &[String], + updated_paths: &[PathOp], + no_shell: bool, + no_environment: bool, +) -> Result { self::imp::Process::new(cmd, updated_paths, no_shell, no_environment).map_err(|e| e.into()) } @@ -83,7 +88,12 @@ mod imp { #[allow(clippy::mutex_atomic)] impl Process { - pub fn new(cmd: &[String], updated_paths: &[PathOp], no_shell: bool, no_environment: bool) -> Result { + pub fn new( + cmd: &[String], + updated_paths: &[PathOp], + no_shell: bool, + no_environment: bool, + ) -> Result { use nix::unistd::*; use std::convert::TryInto; use std::os::unix::process::CommandExt; @@ -234,7 +244,12 @@ mod imp { } impl Process { - pub fn new(cmd: &[String], updated_paths: &[PathOp], no_shell: bool, no_environment: bool) -> Result { + pub fn new( + cmd: &[String], + updated_paths: &[PathOp], + no_shell: bool, + no_environment: bool, + ) -> Result { use std::convert::TryInto; use std::os::windows::io::IntoRawHandle; use std::os::windows::process::CommandExt; diff --git a/src/run.rs b/src/run.rs index 8fbb200..d6ed3d3 100644 --- a/src/run.rs +++ b/src/run.rs @@ -169,7 +169,12 @@ impl ExecHandler { debug!("Launching child process"); let mut guard = self.child_process.write()?; - *guard = Some(process::spawn(&self.args.cmd, ops, self.args.no_shell, self.args.no_environment)?); + *guard = Some(process::spawn( + &self.args.cmd, + ops, + self.args.no_shell, + self.args.no_environment, + )?); Ok(()) } @@ -266,7 +271,12 @@ pub fn run(args: Args) -> Result<()> { watch(&ExecHandler::new(args)?) } -fn wait_fs(rx: &Receiver, filter: &NotificationFilter, debounce: u64, no_meta: bool) -> Vec { +fn wait_fs( + rx: &Receiver, + filter: &NotificationFilter, + debounce: u64, + no_meta: bool, +) -> Vec { let mut paths = Vec::new(); let mut cache = HashMap::new();