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

chore: minor fmt match cleanup

Fix an overly complex case when w is 0. Note that this might have been an error - I kept the logic, but the initial implementation might have been incorrect.
This commit is contained in:
Yuri Astrakhan 2025-04-11 00:44:51 -04:00
parent 5bfbc30fba
commit 74d79589f4

View file

@ -110,9 +110,12 @@ impl FmtOptions {
}
(w, g)
}
(Some(w), None) => {
(Some(0), None) => {
// Only allow a goal of zero if the width is set to be zero
let g = (w * DEFAULT_GOAL_TO_WIDTH_RATIO / 100).max(if w == 0 { 0 } else { 1 });
(0, 0)
}
(Some(w), None) => {
let g = (w * DEFAULT_GOAL_TO_WIDTH_RATIO / 100).max(1);
(w, g)
}
(None, Some(g)) => {