From 6407dc4eb41d0e2c459d7f2098e9dbdb63c18d34 Mon Sep 17 00:00:00 2001 From: psinghal20 Date: Mon, 1 Oct 2018 02:26:32 +0530 Subject: [PATCH] chore: format code via rustfmt --- src/exec/job.rs | 22 ++++++++++++---------- src/walk.rs | 6 ++++-- 2 files changed, 16 insertions(+), 12 deletions(-) diff --git a/src/exec/job.rs b/src/exec/job.rs index 808b015..3300691 100644 --- a/src/exec/job.rs +++ b/src/exec/job.rs @@ -6,17 +6,21 @@ // notice may not be copied, modified, or distributed except // according to those terms. +use super::CommandTemplate; +use internal::error; use std::path::PathBuf; use std::sync::mpsc::Receiver; use std::sync::{Arc, Mutex}; -use::walk::WorkerResult; -use::internal::error; -use super::CommandTemplate; +use walk::WorkerResult; /// An event loop that listens for inputs from the `rx` receiver. Each received input will /// generate a command with the supplied command template. The generated command will then /// be executed, and this process will continue until the receiver's sender has closed. -pub fn job(rx: Arc>>, cmd: Arc, out_perm: Arc>) { +pub fn job( + rx: Arc>>, + cmd: Arc, + out_perm: Arc>, +) { loop { // Create a lock on the shared receiver for this thread. let lock = rx.lock().unwrap(); @@ -24,12 +28,10 @@ pub fn job(rx: Arc>>, cmd: Arc, ou // Obtain the next path from the receiver, else if the channel // has closed, exit from the loop let value: PathBuf = match lock.recv() { - Ok(value) => { - match value { - WorkerResult::Entry(val) => val, - WorkerResult::Error(err) => { - error(&format!("{}", err)); - } + Ok(value) => match value { + WorkerResult::Entry(val) => val, + WorkerResult::Error(err) => { + error(&format!("{}", err)); } }, Err(_) => break, diff --git a/src/walk.rs b/src/walk.rs index d39279b..444db47 100644 --- a/src/walk.rs +++ b/src/walk.rs @@ -39,7 +39,7 @@ enum ReceiverMode { /// The Worker threads can result in a valid entry having PathBuf or an error. pub enum WorkerResult { Entry(PathBuf), - Error(ignore::Error) + Error(ignore::Error), } /// Recursively scan the given search path for files / pathnames matching the pattern. @@ -300,7 +300,9 @@ pub fn scan(path_vec: &[PathBuf], pattern: Arc, config: Arc) { if let Some(search_str) = search_str_o { if pattern.is_match(&*search_str) { // TODO: take care of the unwrap call - tx_thread.send(WorkerResult::Entry(entry_path.to_owned())).unwrap() + tx_thread + .send(WorkerResult::Entry(entry_path.to_owned())) + .unwrap() } }