From 254931e15d785e21a40593a16a24eecf8cef545f Mon Sep 17 00:00:00 2001 From: sharkdp Date: Sat, 21 Sep 2019 14:02:43 +0200 Subject: Rename Err => Error --- src/main.rs | 6 +++--- src/walk.rs | 16 ++++++++-------- 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, u64), - Error { err: Err }, + Error { error: Error }, } fn walk(tx: channel::Sender, entries: &[PathBuf]) { @@ -41,7 +41,7 @@ fn walk(tx: channel::Sender, 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, 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) { + pub fn run(&self) -> (u64, Vec) { 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 = Vec::new(); + let mut error_messages: Vec = 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); } } } -- cgit v1.2.3