mirror of
https://github.com/Llewellynvdm/exa.git
synced 2024-11-27 06:06:28 +00:00
clean up consumer to make code more readable
This commit is contained in:
parent
d9a0458a39
commit
9f9b8ca33e
20
src/main.rs
20
src/main.rs
@ -104,26 +104,24 @@ impl<'a> Exa<'a> {
|
|||||||
// Spawn producer thread
|
// Spawn producer thread
|
||||||
thread::spawn(move || {
|
thread::spawn(move || {
|
||||||
let path = Path::new(file.clone());
|
let path = Path::new(file.clone());
|
||||||
match fs::stat(&path) {
|
let _ = results_tx.send(match fs::stat(&path) {
|
||||||
Ok(stat) => {
|
Ok(stat) => {
|
||||||
if stat.kind == FileType::Directory {
|
if stat.kind != FileType::Directory {
|
||||||
if is_tree {
|
StatResult::File(File::with_stat(stat, &path, None, false))
|
||||||
let _ = results_tx.send(StatResult::File(File::with_stat(stat, &path, None, true)));
|
}
|
||||||
|
else if is_tree {
|
||||||
|
StatResult::File(File::with_stat(stat, &path, None, true))
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
let _ = results_tx.send(StatResult::Path(path));
|
StatResult::Path(path)
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
let _ = results_tx.send(StatResult::File(File::with_stat(stat, &path, None, false)));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
println!("{}: {}", file, e);
|
println!("{}: {}", file, e);
|
||||||
let _ = results_tx.send(StatResult::Error);
|
StatResult::Error
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user