Skip to content
Myr

chore: format code via rustfmt

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by psinghal20 · committed by David Peter · parent 2ebef2d · Browse files · 2 files+16 added−12 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

2 files+16 added−12 removed

  • other:+16 added−12 removed

2 files+16 added−12 removed

modified:src/exec/job.rs+12 added-10 removed
4 unmodified lines
5// at your option. All files in the project carrying such6// notice may not be copied, modified, or distributed except7// according to those terms.89use super::CommandTemplate;10use internal::error;11use std::path::PathBuf;12use std::sync::mpsc::Receiver;13use std::sync::{Arc, Mutex};12use::walk::WorkerResult;13use::internal::error;14use super::CommandTemplate;14use walk::WorkerResult;1516/// An event loop that listens for inputs from the `rx` receiver. Each received input will17/// generate a command with the supplied command template. The generated command will then18/// be executed, and this process will continue until the receiver's sender has closed.19pub fn job(rx: Arc<Mutex<Receiver<WorkerResult>>>, cmd: Arc<CommandTemplate>, out_perm: Arc<Mutex<()>>) {19pub fn job(20 rx: Arc<Mutex<Receiver<WorkerResult>>>,21 cmd: Arc<CommandTemplate>,22 out_perm: Arc<Mutex<()>>,23) {24 loop {25 // Create a lock on the shared receiver for this thread.26 let lock = rx.lock().unwrap();2728 // Obtain the next path from the receiver, else if the channel29 // has closed, exit from the loop30 let value: PathBuf = match lock.recv() {27 Ok(value) => {28 match value {29 WorkerResult::Entry(val) => val,30 WorkerResult::Error(err) => {31 error(&format!("{}", err));31 Ok(value) => match value {32 WorkerResult::Entry(val) => val,33 WorkerResult::Error(err) => {34 error(&format!("{}", err));32 }35 }36 },37 Err(_) => break,38 };
7 unmodified lines
modified:src/walk.rs+4 added-2 removed
37 unmodified lines
3839/// The Worker threads can result in a valid entry having PathBuf or an error.40pub enum WorkerResult {41 Entry(PathBuf),42 Error(ignore::Error)42 Error(ignore::Error),43}4445/// Recursively scan the given search path for files / pathnames matching the pattern.46///
252 unmodified lines
299300 if let Some(search_str) = search_str_o {301 if pattern.is_match(&*search_str) {302 // TODO: take care of the unwrap call303 tx_thread.send(WorkerResult::Entry(entry_path.to_owned())).unwrap()303 tx_thread304 .send(WorkerResult::Entry(entry_path.to_owned()))305 .unwrap()306 }307 }308309 ignore::WalkState::Continue
14 unmodified lines