Cargo fmt

This commit is contained in:
Félix Saparelli 2020-07-04 00:20:02 +12:00
parent f045fd45ac
commit f38e7ab969
4 changed files with 40 additions and 17 deletions

View File

@ -33,18 +33,16 @@ impl From<globset::Error> for Error {
impl From<io::Error> 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,
})
}
}

View File

@ -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 {

View File

@ -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<Process> {
pub fn spawn(
cmd: &[String],
updated_paths: &[PathOp],
no_shell: bool,
no_environment: bool,
) -> Result<Process> {
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<Self> {
pub fn new(
cmd: &[String],
updated_paths: &[PathOp],
no_shell: bool,
no_environment: bool,
) -> Result<Self> {
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<Self> {
pub fn new(
cmd: &[String],
updated_paths: &[PathOp],
no_shell: bool,
no_environment: bool,
) -> Result<Self> {
use std::convert::TryInto;
use std::os::windows::io::IntoRawHandle;
use std::os::windows::process::CommandExt;

View File

@ -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<Event>, filter: &NotificationFilter, debounce: u64, no_meta: bool) -> Vec<PathOp> {
fn wait_fs(
rx: &Receiver<Event>,
filter: &NotificationFilter,
debounce: u64,
no_meta: bool,
) -> Vec<PathOp> {
let mut paths = Vec::new();
let mut cache = HashMap::new();