1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2025-07-28 03:27:44 +00:00

od: use assert! instead of if then panic!

This commit is contained in:
Jeffrey Finkelstein 2021-10-02 09:44:16 -04:00
parent de158c0122
commit 6aee05a0f1

View file

@ -145,13 +145,12 @@ impl OutputInfo {
byte_size_block: usize,
print_width_block: usize,
) -> [usize; MAX_BYTES_PER_UNIT] {
if byte_size_block > MAX_BYTES_PER_UNIT {
panic!(
"{}-bits types are unsupported. Current max={}-bits.",
8 * byte_size_block,
8 * MAX_BYTES_PER_UNIT
);
}
assert!(
byte_size_block <= MAX_BYTES_PER_UNIT,
"{}-bits types are unsupported. Current max={}-bits.",
8 * byte_size_block,
8 * MAX_BYTES_PER_UNIT
);
let mut spacing = [0; MAX_BYTES_PER_UNIT];
let mut byte_size = sf.byte_size();