From 3e332c38398a017762a8a83eaf34a6e2ed8bd116 Mon Sep 17 00:00:00 2001 From: "Tobin C. Harding" Date: Thu, 31 Oct 2024 12:23:50 +1100 Subject: [PATCH] amount: Fix docs on FromStr The docs on `FromStr` say "string slice is zero" but actually mean to document the behaviour when the value represented is zero. Also the fact that `FromStr` returns an error if parsing fails is self evident. --- units/src/amount/signed.rs | 7 +------ units/src/amount/unsigned.rs | 7 +------ 2 files changed, 2 insertions(+), 12 deletions(-) diff --git a/units/src/amount/signed.rs b/units/src/amount/signed.rs index 7c3490e11..78219c73e 100644 --- a/units/src/amount/signed.rs +++ b/units/src/amount/signed.rs @@ -396,12 +396,7 @@ impl FromStr for SignedAmount { /// Parses a string slice where the slice includes a denomination. /// - /// If the string slice is zero or negative zero, then no denomination is required. - /// - /// # Returns - /// - /// The amount if the string amount and denomination parse successfully, - /// otherwise returns `Err(ParseError)`. + /// If the returned value would be zero or negative zero, then no denomination is required. fn from_str(s: &str) -> Result { let result = SignedAmount::from_str_with_denomination(s); diff --git a/units/src/amount/unsigned.rs b/units/src/amount/unsigned.rs index cbc9f07ef..c38257c83 100644 --- a/units/src/amount/unsigned.rs +++ b/units/src/amount/unsigned.rs @@ -361,12 +361,7 @@ impl FromStr for Amount { /// Parses a string slice where the slice includes a denomination. /// - /// If the string slice is zero, then no denomination is required. - /// - /// # Returns - /// - /// The amount if the string amount and denomination parse successfully, - /// otherwise returns `Err(ParseError)`. + /// If the returned value would be zero or negative zero, then no denomination is required. fn from_str(s: &str) -> Result { let result = Amount::from_str_with_denomination(s);