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

Added trait implementations to ParseQuantityError #217

Closed
wants to merge 2 commits into from

Conversation

Lucretiel
Copy link
Contributor

No description provided.

@iliekturtles
Copy link
Owner

Thanks for the PR! I'm planning to review this weekend.

@iliekturtles
Copy link
Owner

Couple minor fixes. If you can review, apply, and then squash your commits I'll merge!

  • use statements can be simplified slightly. uom exposes a lib module to handle std vs. core.
  • UnknownUnit message wording didn't make sense to me. I changed to a possible wording I thought made more sense.
diff --git a/src/lib.rs b/src/lib.rs
index 29115c9..efc91d4 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -621,10 +621,7 @@ pub mod fmt {

 /// Unicode string slice manipulation for quantities.
 pub mod str {
-    use core::fmt::{self, Display, Formatter};
-
-    #[cfg(feature = "std")]
-    use std::error::Error;
+    use crate::lib::fmt::{self, Display, Formatter};

     /// Represents an error encountered while parsing a string into a `Quantity`.
     #[allow(missing_copy_implementations)]
@@ -654,11 +651,11 @@ pub mod str {
             match *self {
                 NoSeparator => write!(f, "no space between quantity and units"),
                 ValueParseError => write!(f, "error parsing unit quantity"),
-                UnknownUnit => write!(f, "unrecognized parsing unit of measure"),
+                UnknownUnit => write!(f, "unrecognized unit of measure"),
             }
         }
     }

     #[cfg(feature = "std")]
-    impl Error for ParseQuantityError {}
+    impl crate::lib::error::Error for ParseQuantityError {}
 }

@Lucretiel
Copy link
Contributor Author

Thanks for the review! Been busy, will follow up this weekend

@iliekturtles
Copy link
Owner

I ended up applying the patch along with assert_all_impl/assert_not_impl_any tests. I'm waiting on build results and will plan on merging unless there was anything else you found.

iliekturtles added a commit that referenced this pull request Nov 25, 2020
Add trait implementations to ParseQuantityError.
@iliekturtles
Copy link
Owner

Manually merged. Thanks so much for the PR!

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.

2 participants