You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In a string format, the leading zero on a minimum width is treated as a padding character. It would make more sense for it to be treated strictly as a leading zero. The status quo permits strange things like this:
assert_eq!(format!("{:<04}", 1), "1000");
Either " 1" or "0001" would be better answers than one that changes the numeric value.
Just to be clear, I agree that this behavior is correct:
assert_eq!(format!("{:0<4}", 1), "1000");
This case uses 0 as its padding character, so you deserve whatever you get.