Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -687,7 +687,6 @@ should_panic_without_expect = "allow" # 2
doc_markdown = "allow"
unused_self = "allow"
enum_glob_use = "allow"
unreadable_literal = "allow"
unnested_or_patterns = "allow"
implicit_hasher = "allow"
struct_field_names = "allow"
Expand Down
12 changes: 6 additions & 6 deletions src/uucore/src/lib/features/format/num_format.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1127,11 +1127,11 @@ mod test {
ForceDecimal::No,
)
};
assert_eq!(f(0.1171875), "0.117188");
assert_eq!(f(0.01171875), "0.0117188");
assert_eq!(f(0.001171875), "0.00117187");
assert_eq!(f(0.0001171875), "0.000117187");
assert_eq!(f(0.001171875001), "0.00117188");
assert_eq!(f(0.117_187_5), "0.117188");
assert_eq!(f(0.011_718_75), "0.0117188");
assert_eq!(f(0.001_171_875), "0.00117187");
assert_eq!(f(0.000_117_187_5), "0.000117187");
assert_eq!(f(0.001_171_875_001), "0.00117188");
}

#[test]
Expand All @@ -1148,7 +1148,7 @@ mod test {
assert_eq!(f(0.001), "0.001");
assert_eq!(f(0.0001), "0.0001");
assert_eq!(f(0.00001), "1e-05");
assert_eq!(f(0.000001), "1e-06");
assert_eq!(f(0.000_001), "1e-06");
}

/// Wrapper function to get a string out of Format.fmt()
Expand Down
12 changes: 6 additions & 6 deletions src/uucore/src/lib/features/parser/num_parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -583,7 +583,7 @@ mod tests {
u64::extended_parse("-9223372036854775808") // i64::MIN
);
assert_eq!(
Ok(1123372036854675616),
Ok(1_123_372_036_854_675_616),
u64::extended_parse("-17323372036854876000") // 2*i64::MIN
);
assert_eq!(Ok(1), u64::extended_parse("-18446744073709551615")); // -u64::MAX
Expand Down Expand Up @@ -679,10 +679,10 @@ mod tests {
assert_eq!(Ok(123.15), f64::extended_parse("0123.15"));
assert_eq!(Ok(123.15), f64::extended_parse("+0123.15"));
assert_eq!(Ok(-123.15), f64::extended_parse("-0123.15"));
assert_eq!(Ok(12315000.0), f64::extended_parse("123.15e5"));
assert_eq!(Ok(-12315000.0), f64::extended_parse("-123.15e5"));
assert_eq!(Ok(12315000.0), f64::extended_parse("123.15E+5"));
assert_eq!(Ok(0.0012315), f64::extended_parse("123.15E-5"));
assert_eq!(Ok(12_315_000.0), f64::extended_parse("123.15e5"));
assert_eq!(Ok(-12_315_000.0), f64::extended_parse("-123.15e5"));
assert_eq!(Ok(12_315_000.0), f64::extended_parse("123.15E+5"));
assert_eq!(Ok(0.001_231_5), f64::extended_parse("123.15E-5"));
assert_eq!(
Ok(0.15),
f64::extended_parse(".150000000000000000000000000231313")
Expand Down Expand Up @@ -933,7 +933,7 @@ mod tests {

// We cannot really check that 'e' is not a valid exponent indicator for hex floats...
// but we can check that the number still gets parsed properly: 0x0.8e5 is 0x8e5 / 16**3
assert_eq!(Ok(0.555908203125), f64::extended_parse("0x0.8e5"));
assert_eq!(Ok(0.555_908_203_125), f64::extended_parse("0x0.8e5"));

assert_eq!(
f64::extended_parse("0x0.1p"),
Expand Down
2 changes: 1 addition & 1 deletion src/uucore/src/lib/features/parser/parse_time.rs
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ pub fn from_str(string: &str, allow_suffixes: bool) -> Result<Duration, String>
return Ok(Duration::MAX);
}
// early return if number is too small (< 1 ns)
if !bd.is_zero() && bd < bigdecimal::BigDecimal::from_f64(0.0000000001).unwrap() {
if !bd.is_zero() && bd < bigdecimal::BigDecimal::from_f64(0.000_000_000_1).unwrap() {
return Ok(NANOSECOND_DURATION);
}
bd
Expand Down
16 changes: 8 additions & 8 deletions src/uucore/src/lib/features/sum.rs
Original file line number Diff line number Diff line change
Expand Up @@ -175,10 +175,10 @@ impl Crc {
crc_fast::CrcParams::new(
"CRC-32/CKSUM", // Name
32, // Width
0x04c11db7, // Polynomial
0x00000000, // Initial CRC value: 0 (not 0xffffffff)
0x04c1_1db7, // Polynomial
0x0000_0000, // Initial CRC value: 0 (not 0xffffffff)
false, // No input reflection (refin)
0xffffffff, // XOR output with 0xffffffff (xorout)
0xffff_ffff, // XOR output with 0xffffffff (xorout)
0, // Check value (not used)
)
}
Expand Down Expand Up @@ -245,7 +245,7 @@ impl Digest for CRC32B {
let result = self.digest.finalize();
// crc_fast returns a 64-bit value, but CRC32B should be 32-bit
// Take the lower 32 bits and convert to big-endian bytes
let crc32_value = (result & 0xffffffff) as u32;
let crc32_value = (result & 0xffff_ffff) as u32;
out.copy_from_slice(&crc32_value.to_be_bytes());
}

Expand Down Expand Up @@ -601,7 +601,7 @@ mod tests {
assert_ne!(empty_result, test_result);

// Test known value: "test" should give 3076352578
assert_eq!(test_result, 3076352578);
assert_eq!(test_result, 3_076_352_578);
}

#[test]
Expand Down Expand Up @@ -653,9 +653,9 @@ mod tests {
// Test against our CRC implementation values
// Note: These are the correct values for our POSIX cksum implementation
let test_cases = [
("", 4294967295_u64),
("a", 1220704766_u64),
("abc", 1219131554_u64),
("", 4_294_967_295_u64),
("a", 1_220_704_766_u64),
("abc", 1_219_131_554_u64),
];

for (input, expected) in test_cases {
Expand Down
6 changes: 3 additions & 3 deletions tests/by-util/test_dd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1901,7 +1901,7 @@ fn test_skip_overflow() {
#[cfg(target_os = "linux")]
fn test_nocache_eof() {
let (at, mut ucmd) = at_and_ucmd!();
at.write_bytes("in.f", &vec![0u8; 1234567]);
at.write_bytes("in.f", &vec![0u8; 1_234_567]);
ucmd.args(&[
"if=in.f",
"of=out.f",
Expand All @@ -1910,15 +1910,15 @@ fn test_nocache_eof() {
"status=noxfer",
])
.succeeds();
assert_eq!(at.read_bytes("out.f").len(), 1234567);
assert_eq!(at.read_bytes("out.f").len(), 1_234_567);
}

#[test]
#[cfg(all(target_os = "linux", feature = "printf"))]
fn test_nocache_eof_fadvise_zero_length() {
use std::process::Command;
let (at, _ucmd) = at_and_ucmd!();
at.write_bytes("in.f", &vec![0u8; 1234567]);
at.write_bytes("in.f", &vec![0u8; 1_234_567]);

let strace_file = at.plus_as_string("strace.out");
let result = Command::new("strace")
Expand Down
4 changes: 2 additions & 2 deletions tests/by-util/test_shred.rs
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,7 @@ fn test_shred_non_utf8_paths() {
fn test_gnu_shred_passes_20() {
let (at, mut ucmd) = at_and_ucmd!();

let us_data = vec![0x55; 102400]; // 100K of 'U' bytes
let us_data = vec![0x55; 102_400]; // 100K of 'U' bytes
at.write_bytes("Us", &us_data);

let file = "f";
Expand Down Expand Up @@ -397,7 +397,7 @@ fn test_gnu_shred_passes_20() {
fn test_gnu_shred_passes_different_counts() {
let (at, mut ucmd) = at_and_ucmd!();

let us_data = vec![0x55; 102400];
let us_data = vec![0x55; 102_400];
at.write_bytes("Us", &us_data);

let file = "f";
Expand Down
Loading