From d083b93f083a805c43def0986338a455aff7e376 Mon Sep 17 00:00:00 2001 From: Austen Adler Date: Wed, 15 Nov 2023 23:29:34 -0500 Subject: [PATCH] Run cargo fmt --- src/collector.rs | 16 +++++++++------- src/main.rs | 2 +- src/tar.rs | 5 +---- 3 files changed, 11 insertions(+), 12 deletions(-) diff --git a/src/collector.rs b/src/collector.rs index 9cef6ba..3786c68 100644 --- a/src/collector.rs +++ b/src/collector.rs @@ -2,10 +2,14 @@ use std::io::Write; use crate::types; use anyhow::Result; -use ncdufmt::{MajorVersion, MinorVersion, HeaderMetadata, InfoBlock, NcduFile, Directory, FileOrDirectory}; +use ncdufmt::{ + Directory, FileOrDirectory, HeaderMetadata, InfoBlock, MajorVersion, MinorVersion, NcduFile, +}; /// Builds an ncdu file from a stream -pub fn build_ncdu_file(rx: crossbeam::channel::Receiver/*, _writer: impl Write*/) -> Result { +pub fn build_ncdu_file( + rx: crossbeam::channel::Receiver, /*, _writer: impl Write*/ +) -> Result { let mut ret = NcduFile { major_version: MajorVersion::default(), minor_version: MinorVersion::default(), @@ -13,20 +17,18 @@ pub fn build_ncdu_file(rx: crossbeam::channel::Receiver/*, _writer contents: Directory { info: InfoBlock::new("test-filename.tar".to_string()), contents: Vec::default(), - } + }, }; - + while let Ok(entry) = rx.recv() { let mut e = InfoBlock::new(entry.path.to_string_lossy()); e.asize = entry.size; - ret.contents.contents.push(FileOrDirectory::File(e) ); + ret.contents.contents.push(FileOrDirectory::File(e)); } Ok(ret) } - - #[cfg(test)] mod tests { use std::fs::File; diff --git a/src/main.rs b/src/main.rs index 26427d0..a6313f7 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,6 +1,6 @@ +mod collector; mod tar; mod types; -mod collector; fn main() { println!("Hello, world!"); diff --git a/src/tar.rs b/src/tar.rs index 0dc2d36..038bc50 100644 --- a/src/tar.rs +++ b/src/tar.rs @@ -8,10 +8,7 @@ use tar::Archive; /// Sends tar entries to a channel /// /// The tar file must be in a decompressed state -pub fn get_entries( - tx: crossbeam::channel::Sender, - reader: impl Read, -) -> Result<()> { +pub fn get_entries(tx: crossbeam::channel::Sender, reader: impl Read) -> Result<()> { let mut archive = Archive::new(reader); for entry in archive.entries()? {