Conversation
If we use `self`, without the ampersand, then calling the method will consume the struct (like moving it) and it won't be usable again.
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR fixes issues with unit types by updating the division operator to return a Dimensionless type and modifying methods to take self by reference instead of by value.
- Update division operator to yield Dimensionless
- Change method signatures (value, is_normal, is_finite, abs) to use &self
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #654 +/- ##
=======================================
Coverage 88.43% 88.43%
=======================================
Files 39 39
Lines 3555 3555
Branches 3555 3555
=======================================
Hits 3144 3144
Misses 219 219
Partials 192 192 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Collaborator
Silly me 🤦 |
tsmbland
approved these changes
Jun 23, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
I was fiddling with unit types on another branch and noticed a couple of small problems:
Udivided byUshould yieldDimensionless, notU&self) not value (self) for various methods of unit types, otherwise it'll be consumed when they're runType of change
Key checklist
$ cargo test$ cargo docFurther checks