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
Provenance
- Commit
6407dc4- Tree
fef9827- Author
psinghal20 <psinghal20@gmail.com>- Committer
David Peter <sharkdp@users.noreply.github.com>- Parent
2ebef2d
2 files changed+16 added−12 removed
modified:src/exec/job.rs+12 added-10 removed
4 unmodified lines5 // at your option. All files in the project carrying such6 // notice may not be copied, modified, or distributed except7 // according to those terms.8 9+use super::CommandTemplate;10+use internal::error;11 use std::path::PathBuf;12 use std::sync::mpsc::Receiver;13 use std::sync::{Arc, Mutex};12-use::walk::WorkerResult;13-use::internal::error;14-use super::CommandTemplate;14+use walk::WorkerResult;15 16 /// 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.19-pub fn job(rx: Arc<Mutex<Receiver<WorkerResult>>>, cmd: Arc<CommandTemplate>, out_perm: Arc<Mutex<()>>) {19+pub 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();27 28 // 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 linesmodified:src/walk.rs+4 added-2 removed
37 unmodified lines38 39 /// The Worker threads can result in a valid entry having PathBuf or an error.40 pub enum WorkerResult {41 Entry(PathBuf),42- Error(ignore::Error)42+ Error(ignore::Error),43 }44 45 /// Recursively scan the given search path for files / pathnames matching the pattern.46 ///252 unmodified lines299 300 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 }308 309 ignore::WalkState::Continue14 unmodified lines