Skip to content

Commit bfa5d93

Browse files
committed
number-prefix: Move from 0.2 to 0.4
1 parent d5764b3 commit bfa5d93

File tree

5 files changed

+33
-34
lines changed

5 files changed

+33
-34
lines changed

Cargo.lock

Lines changed: 18 additions & 21 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/uu/df/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ path = "src/df.rs"
1717
[dependencies]
1818
clap = "2.33"
1919
libc = "0.2"
20-
number_prefix = "0.2"
20+
number_prefix = "0.4"
2121
uucore = { version=">=0.0.4", package="uucore", path="../../uucore" }
2222
uucore_procs = { version=">=0.0.4", package="uucore_procs", path="../../uucore_procs" }
2323

src/uu/df/src/df.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ use winapi::um::fileapi::{
2828
GetVolumePathNamesForVolumeNameW, QueryDosDeviceW,
2929
};
3030

31-
use number_prefix::{binary_prefix, decimal_prefix, PrefixNames, Prefixed, Standalone};
31+
use number_prefix::NumberPrefix;
3232
use std::cell::Cell;
3333
use std::collections::HashMap;
3434
use std::collections::HashSet;
@@ -716,14 +716,14 @@ fn human_readable(value: u64, base: i64) -> String {
716716

717717
// ref: [Binary prefix](https://en.wikipedia.org/wiki/Binary_prefix) @@ <https://archive.is/cnwmF>
718718
// ref: [SI/metric prefix](https://en.wikipedia.org/wiki/Metric_prefix) @@ <https://archive.is/QIuLj>
719-
1000 => match decimal_prefix(value as f64) {
720-
Standalone(bytes) => bytes.to_string(),
721-
Prefixed(prefix, bytes) => format!("{:.1}{}", bytes, prefix.symbol()),
719+
1000 => match NumberPrefix::decimal(value as f64) {
720+
NumberPrefix::Standalone(bytes) => bytes.to_string(),
721+
NumberPrefix::Prefixed(prefix, bytes) => format!("{:.1}{}", bytes, prefix.symbol()),
722722
},
723723

724-
1024 => match binary_prefix(value as f64) {
725-
Standalone(bytes) => bytes.to_string(),
726-
Prefixed(prefix, bytes) => format!("{:.1}{}", bytes, prefix.symbol()),
724+
1024 => match NumberPrefix::binary(value as f64) {
725+
NumberPrefix::Standalone(bytes) => bytes.to_string(),
726+
NumberPrefix::Prefixed(prefix, bytes) => format!("{:.1}{}", bytes, prefix.symbol()),
727727
},
728728

729729
_ => crash!(EXIT_ERR, "Internal error: Unknown base value {}", base),

src/uu/ls/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ path = "src/ls.rs"
1818
getopts = "0.2.18"
1919
isatty = "0.1"
2020
lazy_static = "1.0.1"
21-
number_prefix = "0.2.8"
21+
number_prefix = "0.4"
2222
term_grid = "0.1.5"
2323
termsize = "0.1.6"
2424
time = "0.1.40"

src/uu/ls/src/ls.rs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ extern crate uucore;
2424

2525
#[cfg(unix)]
2626
use isatty::stdout_isatty;
27-
use number_prefix::{decimal_prefix, Prefixed, Standalone};
27+
use number_prefix::NumberPrefix;
2828
use std::cmp::Reverse;
2929
#[cfg(unix)]
3030
use std::collections::HashMap;
@@ -525,9 +525,11 @@ fn display_date(metadata: &Metadata, options: &getopts::Matches) -> String {
525525

526526
fn display_file_size(metadata: &Metadata, options: &getopts::Matches) -> String {
527527
if options.opt_present("human-readable") {
528-
match decimal_prefix(metadata.len() as f64) {
529-
Standalone(bytes) => bytes.to_string(),
530-
Prefixed(prefix, bytes) => format!("{:.2}{}", bytes, prefix).to_uppercase(),
528+
match NumberPrefix::decimal(metadata.len() as f64) {
529+
NumberPrefix::Standalone(bytes) => bytes.to_string(),
530+
NumberPrefix::Prefixed(prefix, bytes) => {
531+
format!("{:.2}{}", bytes, prefix).to_uppercase()
532+
}
531533
}
532534
} else {
533535
metadata.len().to_string()

0 commit comments

Comments
 (0)