Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Removes vestigial dependency on BigDecimal #594

Merged
merged 3 commits into from
Jul 5, 2023
Merged

Removes vestigial dependency on BigDecimal #594

merged 3 commits into from
Jul 5, 2023

Conversation

zslayton
Copy link
Contributor

@zslayton zslayton commented Jul 5, 2023

Early versions of ion-rust used the third-party BigDecimal type to represent Ion decimal values. The library has had its own Decimal type for a while now that provides a correct representation of negative zero and properly implements Ion equality testing.

This PR removes the library's remaining uses of BigDecimal and drops the dependency.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@codecov
Copy link

codecov bot commented Jul 5, 2023

Codecov Report

Patch coverage: 100.00% and project coverage change: -0.04 ⚠️

Comparison is base (9c19ab6) 82.87% compared to head (c6630c6) 82.84%.

❗ Current head c6630c6 differs from pull request most recent head 2fe6100. Consider uploading reports for the commit 2fe6100 to get more accurate results

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #594      +/-   ##
==========================================
- Coverage   82.87%   82.84%   -0.04%     
==========================================
  Files         111      111              
  Lines       19365    19302      -63     
  Branches    19365    19302      -63     
==========================================
- Hits        16049    15990      -59     
+ Misses       1773     1770       -3     
+ Partials     1543     1542       -1     
Impacted Files Coverage Δ
src/binary/decimal.rs 89.15% <ø> (ø)
src/lib.rs 33.33% <ø> (ø)
src/text/raw_text_writer.rs 85.53% <ø> (-0.14%) ⬇️
src/types/decimal/mod.rs 91.09% <ø> (-0.85%) ⬇️
src/element/reader.rs 91.34% <100.00%> (-0.69%) ⬇️

... and 2 files with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

Copy link
Contributor Author

@zslayton zslayton left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🗺️ PR tour

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🗺️ Most of the changes in this file are to use implicit conversions to avoid going from Rust type -> Value -> Element. They now go directly from Rust type -> Element.

src/lib.rs Outdated
pub mod external {
pub use bigdecimal;
}
pub mod external {}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🗺️ I think we still need this for dependencies behind opt-in feature gates.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(Question) Can we remove this module as it doesn't have any dependencies at the moment? Later when we need re-exports for the opt-in features, we can create the module for it.
Having this in crate docs with no dependencies in it might be confusing, so we should either add a comment or an issue link stating why we have kept it or indicating why this is empty at the moment.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great point, I'll take it out.

@zslayton zslayton marked this pull request as ready for review July 5, 2023 19:40
Copy link
Contributor

@popematt popematt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Given that crate A can't implement a trait from crate B for a type from crate C, we might eventually realize that we want to provide From<BigDecimal> for Decimal or Element behind a feature flag.

...but I don't think that's any reason not to make the change.

@zslayton zslayton merged commit 5510b3f into main Jul 5, 2023
18 of 19 checks passed
@zslayton zslayton deleted the rm-big-decimal branch July 5, 2023 21:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants