🧹 refactor: update skeleton items for formatting digits#360
Conversation
Addressing the TODO in rust_icu_ecma402/src/numberformat.rs by: - Implementing conditional logic to choose between significant and fraction digits in skeleton_from, adhering to ECMA-402 precedence rules. - Fixing a default value logic error where maximum_fraction_digits could be less than minimum_fraction_digits. - Correcting 'sign-expect-zero' typo to 'sign-except-zero' and fixing the mapping for SignDisplay::ExceptZero. - Refactoring the internal skeleton generation to use more granular helpers: fraction_precision and significant_digits. - Updating and adding unit tests to verify the improved logic and output. This commit was created by an automated coding assistant, with human supervision. Co-authored-by: filmil <246576+filmil@users.noreply.github.com>
|
👋 Jules, reporting for duty! I'm here to lend a hand with this pull request. When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down. I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job! For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
| "fraction_digits: min: {}, max: {} min_sig: {}, max_sig: {}", | ||
| min, max, min_sig, max_sig | ||
| ); | ||
| assert!(min <= max, "fraction_digits: min: {}, max: {}", min, max); |
There was a problem hiding this comment.
Might want to retain the min <= max assertion in significant_digits() and fraction_precision() - it will give a clearer error message than the current failure does.
This PR refactors the ICU number skeleton generation in
rust_icu_ecma402/src/numberformat.rsto correctly handle digit formatting options and resolve a pending TODO.Key Changes:
minimum_significant_digitsormaximum_significant_digitsare specified, they are used to generate the skeleton and fraction digits are ignored.maximum_fraction_digitsto ensure it is always at least the value ofminimum_fraction_digits, preventing potential assertion failures.sign-expect-zerotypo tosign-except-zero.SignDisplay::ExceptZeromapping to usesign-except-zero.fraction_digitshelper with cleaner, more specificfraction_precisionandsignificant_digitshelpers.minimum_fraction_digitsis correctly respected even whenmaximum_fraction_digitsis not provided.Verification:
read_file.rust_icu_ecma402to reflect improvements.PR created automatically by Jules for task 13618586625975361061 started by @filmil