tiffany352 / rink-rs

Unit conversion tool and library written in rust
https://rinkcalc.app/about
GNU General Public License v3.0
406 stars 28 forks source link

Display impls use token formatting #183

Closed tiffany352 closed 1 month ago

tiffany352 commented 1 month ago

Deduplicates a bunch of code by having Display impls use the TokenFmt implementations. There were some bugs with the TokenFmt formatting that I had to fix, and some slight differences in their output that required adjusting tests. This also fixes a longstanding bug where there were 2 spaces in the output, like 42 (dimensionless).

I also got rid of that two-step pattern parsing stuff, it's simpler to iterate the chars of the pattern string instead.

codecov[bot] commented 1 month ago

Codecov Report

Attention: Patch coverage is 69.35484% with 19 lines in your changes are missing coverage. Please review.

Project coverage is 81.97%. Comparing base (09c5163) to head (c90650a).

Files Patch % Lines
core/src/output/reply.rs 15.38% 11 Missing :warning:
core/src/output/fmt.rs 69.56% 7 Missing :warning:
core/src/output/number_parts.rs 96.15% 1 Missing :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #183 +/- ## ========================================== + Coverage 81.83% 81.97% +0.13% ========================================== Files 42 42 Lines 7885 7632 -253 ========================================== - Hits 6453 6256 -197 + Misses 1432 1376 -56 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.