Adjust wording on docs to match function behaviour
What changed, and why it matters
This commit only fixes wording in code comments/documentation. It changes descriptions of three functions so the docs accurately describe what the functions do. No actual code behavior was changed, so there is no security impact.
No security action needed. Treat as a normal documentation cleanup commit.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The patch is a pure documentation correction in three Rust source files. It changes ‘Converts this [Signed/Unsigned]Amount in floating-point notation’ to ‘Constructs a [Signed/Unsigned]Amount from floating-point notation’ for the from_float_in constructors, and changes ‘Returns the contained Some value’ to ‘Returns the contained Valid value’ for NumOpResult::unwrap_or and unwrap_or_else. No executable code, signatures, logic, or safety properties were modified.
Changed components
units/src/amount/signed.rs documentationunits/src/amount/unsigned.rs documentationunits/src/result.rs documentationInspect captured patch +4 / −4
diff --git a/units/src/amount/signed.rs b/units/src/amount/signed.rs
index 91395c85..e90ce2a4 100644
--- a/units/src/amount/signed.rs
+++ b/units/src/amount/signed.rs
@@ -295,7 +295,7 @@ impl SignedAmount {
#[cfg(feature = "alloc")]
pub fn to_btc(self) -> f64 { self.to_float_in(Denomination::Bitcoin) }
- /// Converts this [`SignedAmount`] in floating-point notation in the given [`Denomination`].
+ /// Constructs a [`SignedAmount`] from floating-point notation in the given [`Denomination`].
///
/// # Errors
///
diff --git a/units/src/amount/unsigned.rs b/units/src/amount/unsigned.rs
index cf6d0adb..6dc7b71d 100644
--- a/units/src/amount/unsigned.rs
+++ b/units/src/amount/unsigned.rs
@@ -258,7 +258,7 @@ impl Amount {
#[cfg(feature = "alloc")]
pub fn to_btc(self) -> f64 { self.to_float_in(Denomination::Bitcoin) }
- /// Converts this [`Amount`] in floating-point notation in the given [`Denomination`].
+ /// Constructs an [`Amount`] from floating-point notation in the given [`Denomination`].
///
/// # Errors
///
diff --git a/units/src/result.rs b/units/src/result.rs
index b209f516..a80cf031 100644
--- a/units/src/result.rs
+++ b/units/src/result.rs
@@ -148,7 +148,7 @@ impl<T: fmt::Debug> NumOpResult<T> {
}
}
- /// Returns the contained Some value or a provided default.
+ /// Returns the contained `Valid` value or a provided default.
///
/// Arguments passed to `unwrap_or` are eagerly evaluated; if you are passing the result of a
/// function call, it is recommended to use `unwrap_or_else`, which is lazily evaluated.
@@ -161,7 +161,7 @@ impl<T: fmt::Debug> NumOpResult<T> {
}
}
- /// Returns the contained `Some` value or computes it from a closure.
+ /// Returns the contained `Valid` value or computes it from a closure.
#[inline]
#[track_caller]
pub fn unwrap_or_else<F>(self, f: F) -> T
Why this scored 15/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.