summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsharkdp <davidpeter@web.de>2019-09-21 14:02:43 +0200
committersharkdp <davidpeter@web.de>2019-09-21 14:02:43 +0200
commit254931e15d785e21a40593a16a24eecf8cef545f (patch)
treebfd15c80d2ba1daaf0c4f1f729ec236f07123463
parent6e27b5dc17876f11c0e4f602b912e99c078da2dd (diff)
Rename Err => Error
-rw-r--r--src/main.rs6
-rw-r--r--src/walk.rs16
2 files changed, 11 insertions, 11 deletions
diff --git a/src/main.rs b/src/main.rs
index 7921df0..57f7c9e 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -7,17 +7,17 @@ use num_format::{Locale, ToFormattedString};
use diskus::walk::{self, Walk};
-fn print_result(size: u64, errors: &[walk::Err], size_format: &FileSizeOpts, verbose: bool) {
+fn print_result(size: u64, errors: &[walk::Error], size_format: &FileSizeOpts, verbose: bool) {
if verbose {
for err in errors {
match err {
- walk::Err::NoMetadataForPath(path) => {
+ walk::Error::NoMetadataForPath(path) => {
eprintln!(
"diskus: could not retrieve metadata for path '{}'",
path.to_string_lossy()
);
}
- walk::Err::CouldNotReadDir(path) => {
+ walk::Error::CouldNotReadDir(path) => {
eprintln!(
"diskus: could not read contents of directory '{}'",
path.to_string_lossy()
diff --git a/src/walk.rs b/src/walk.rs
index 25a2f73..e982549 100644
--- a/src/walk.rs
+++ b/src/walk.rs
@@ -9,14 +9,14 @@ use rayon::{self, prelude::*};
use crate::unique_id::{generate_unique_id, UniqueID};
-pub enum Err {
+pub enum Error {
NoMetadataForPath(PathBuf),
CouldNotReadDir(PathBuf),
}
enum Message {
SizeEntry(Option<UniqueID>, u64),
- Error { err: Err },
+ Error { error: Error },
}
fn walk(tx: channel::Sender<Message>, entries: &[PathBuf]) {
@@ -41,7 +41,7 @@ fn walk(tx: channel::Sender<Message>, entries: &[PathBuf]) {
Err(_) => {
tx_ref
.send(Message::Error {
- err: Err::CouldNotReadDir(entry.clone()),
+ error: Error::CouldNotReadDir(entry.clone()),
})
.unwrap();
}
@@ -52,7 +52,7 @@ fn walk(tx: channel::Sender<Message>, entries: &[PathBuf]) {
} else {
tx_ref
.send(Message::Error {
- err: Err::NoMetadataForPath(entry.clone()),
+ error: Error::NoMetadataForPath(entry.clone()),
})
.unwrap();
};
@@ -72,13 +72,13 @@ impl<'a> Walk<'a> {
}
}
- pub fn run(&self) -> (u64, Vec<Err>) {
+ pub fn run(&self) -> (u64, Vec<Error>) {
let (tx, rx) = channel::unbounded();
let receiver_thread = thread::spawn(move || {
let mut total = 0;
let mut ids = HashSet::new();
- let mut error_messages: Vec<Err> = Vec::new();
+ let mut error_messages: Vec<Error> = Vec::new();
for msg in rx {
match msg {
Message::SizeEntry(unique_id, size) => {
@@ -91,8 +91,8 @@ impl<'a> Walk<'a> {
total += size;
}
}
- Message::Error { err } => {
- error_messages.push(err);
+ Message::Error { error } => {
+ error_messages.push(error);
}
}
}