From 324ddec41d474bb4840a2b76db48b5f97ed65889 Mon Sep 17 00:00:00 2001 From: Benedikt Peetz Date: Sat, 24 Aug 2024 11:39:17 +0200 Subject: fix(treewide): Always display bytes in a formatted way through `Bytes` --- src/download/mod.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/download/mod.rs') diff --git a/src/download/mod.rs b/src/download/mod.rs index ad807f6..2a19a3a 100644 --- a/src/download/mod.rs +++ b/src/download/mod.rs @@ -8,7 +8,7 @@ // You should have received a copy of the License along with this program. // If not, see . -use std::{collections::HashMap, sync::Arc, time::Duration}; +use std::{collections::HashMap, str::FromStr, sync::Arc, time::Duration}; use crate::{ app::App, @@ -24,7 +24,7 @@ use crate::{ use anyhow::{bail, Context, Result}; use bytes::Bytes; use futures::{future::BoxFuture, FutureExt}; -use log::{debug, info, warn}; +use log::{debug, error, info, warn}; use tokio::{fs, task::JoinHandle, time}; mod download_options; @@ -156,8 +156,8 @@ impl Downloader { } let val = dir_size(fs::read_dir(&app.config.paths.download_dir).await?).await; - if let Ok(val) = val.as_ref() { - info!("Cache dir has a size of '{}'", val); + if let Ok(val) = val { + info!("Cache dir has a size of '{}'", Bytes::new(val)); } val } -- cgit 1.4.1