Author: Daniel Noland [daniel@stateless.net]
Committer: Jason White [github@jasonwhite.io] Tue, 13 Sep 2022 05:29:00 +0000
Hash: 3cb741649edb0178668e38ee1c2bb65037f61288
Timestamp: Tue, 13 Sep 2022 05:29:00 +0000 (2 years ago)

+19 -7 +/-3 browse
Bump to humansize 2
Bump to humansize 2

Trivial refactor required.
1diff --git a/Cargo.lock b/Cargo.lock
2index f7c495d..9c2d081 100644
3--- a/Cargo.lock
4+++ b/Cargo.lock
5 @@ -75,7 +75,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
6 checksum = "bf722b94118a07fcbc6640190f247334027685d4e218b794dbfe17c32bf38ed0"
7 dependencies = [
8 "askama_escape",
9- "humansize",
10+ "humansize 1.1.1",
11 "mime",
12 "mime_guess",
13 "nom",
14 @@ -643,6 +643,15 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
15 checksum = "02296996cb8796d7c6e3bc2d9211b7802812d36999a51bb754123ead7d37d026"
16
17 [[package]]
18+ name = "humansize"
19+ version = "2.0.0"
20+ source = "registry+https://github.com/rust-lang/crates.io-index"
21+ checksum = "8e12090e3b87a266157c30eef7ee8f430f4226feb8dd970cccea2cc67f52f70e"
22+ dependencies = [
23+ "libm",
24+ ]
25+
26+ [[package]]
27 name = "humantime"
28 version = "1.3.0"
29 source = "registry+https://github.com/rust-lang/crates.io-index"
30 @@ -773,6 +782,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
31 checksum = "8371e4e5341c3a96db127eb2465ac681ced4c433e01dd0e938adbef26ba93ba5"
32
33 [[package]]
34+ name = "libm"
35+ version = "0.2.5"
36+ source = "registry+https://github.com/rust-lang/crates.io-index"
37+ checksum = "292a948cd991e376cf75541fe5b97a1081d713c618b4f1b9500f8844e49eb565"
38+
39+ [[package]]
40 name = "linked-hash-map"
41 version = "0.5.6"
42 source = "registry+https://github.com/rust-lang/crates.io-index"
43 @@ -1132,7 +1147,7 @@ dependencies = [
44 "hex",
45 "http",
46 "human-size",
47- "humansize",
48+ "humansize 2.0.0",
49 "humantime 2.1.0",
50 "hyper",
51 "linked-hash-map",
52 diff --git a/Cargo.toml b/Cargo.toml
53index 37577a4..94a2173 100644
54--- a/Cargo.toml
55+++ b/Cargo.toml
56 @@ -27,7 +27,7 @@ generic-array = "0.14"
57 hex = "0.4"
58 http = "0.2"
59 human-size = "0.4"
60- humansize = "1"
61+ humansize = "2"
62 humantime = "2"
63 hyper = { version = "0.14", features = ["server", "http1", "http2", "tcp", "stream"] }
64 linked-hash-map = { version = "0.5", features = ["serde_impl"] }
65 diff --git a/src/storage/cached.rs b/src/storage/cached.rs
66index 168c309..f9006ee 100644
67--- a/src/storage/cached.rs
68+++ b/src/storage/cached.rs
69 @@ -29,7 +29,6 @@ use futures::{
70 future::{self, FutureExt, TryFutureExt},
71 stream::{StreamExt, TryStreamExt},
72 };
73- use humansize::{file_size_opts as file_size, FileSize};
74 use tokio::{self, sync::Mutex};
75
76 use crate::lru;
77 @@ -109,9 +108,7 @@ where
78 log::info!(
79 "Prepopulated cache with {} entries ({})",
80 lru.len(),
81- lru.size()
82- .file_size(file_size::DECIMAL)
83- .unwrap_or_else(|e| e)
84+ humansize::format_size(lru.size(), humansize::DECIMAL),
85 );
86
87 let lru = Arc::new(Mutex::new(lru));