Fix typos, grammar and formatting in docs
What changed, and why it matters
This commit only fixes typos, grammar, punctuation, and formatting in documentation comments and one code example. There are no code logic changes, no API changes, and no behavior changes. It is purely a documentation quality cleanup.
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 diff consists entirely of documentation comment edits in Rust source files under units/src. Changes include correcting spelling/grammar (‘an’ vs ‘a’, missing articles, ‘as’ vs ‘is’), adding missing punctuation and closing code fences, fixing a malformed numeric literal in a doc example (1_00 to 100), and minor formatting. No executable code, type definitions, function bodies, or public APIs were modified.
Changed components
units/src/amount/mod.rsunits/src/amount/signed.rsunits/src/block.rsunits/src/locktime/absolute/error.rsunits/src/locktime/absolute/mod.rsunits/src/locktime/relative/mod.rsunits/src/pow.rsunits/src/result.rsunits/src/sequence.rsInspect captured patch +22 / −21
diff --git a/units/src/amount/mod.rs b/units/src/amount/mod.rs
index ce99c988..93c60a93 100644
--- a/units/src/amount/mod.rs
+++ b/units/src/amount/mod.rs
@@ -155,7 +155,7 @@ impl Denomination {
}
}
-/// These forms are ambiguous and could have many meanings. For example, M could denote Mega or Milli.
+/// These forms are ambiguous and could have many meanings. For example, M could denote Mega or Milli.
/// If any of these forms are used, an error type `PossiblyConfusingDenomination` is returned.
const CONFUSING_FORMS: [&str; 6] = ["CBTC", "Cbtc", "MBTC", "Mbtc", "UBTC", "Ubtc"];
@@ -584,7 +584,7 @@ fn fmt_satoshi_in(
///
/// Note: This implementation is currently **unstable**. The only thing that we can promise is that
/// unless the precision is changed, this will display an accurate, human-readable number, and the
-/// default serialization (one with unmodified [`fmt::Formatter`] options) will round-trip with [`FromStr`]
+/// default serialization (one with unmodified [`fmt::Formatter`] options) will round-trip with [`FromStr`].
///
/// See [`Amount::display_in`] and [`Amount::display_dynamic`] on how to construct this.
#[derive(Debug, Clone)]
diff --git a/units/src/amount/signed.rs b/units/src/amount/signed.rs
index 97810396..91395c85 100644
--- a/units/src/amount/signed.rs
+++ b/units/src/amount/signed.rs
@@ -133,7 +133,7 @@ impl SignedAmount {
/// Construct a [`SignedAmount`] value from a `u64` satoshi value.
///
- /// # Errors:
+ /// # Errors
///
/// Returns an [`OutOfRangeError`] if the satoshi value > [`Self::MAX_MONEY`].
#[inline]
@@ -405,7 +405,7 @@ impl SignedAmount {
self.abs().to_unsigned().expect("a positive signed amount is always valid")
}
- /// Returns a number representing sign of this [`SignedAmount`].
+ /// Returns a number representing the sign of this [`SignedAmount`].
///
/// - `0` if the amount is zero
/// - `1` if the amount is positive
diff --git a/units/src/block.rs b/units/src/block.rs
index 349e3213..4b9869ea 100644
--- a/units/src/block.rs
+++ b/units/src/block.rs
@@ -4,7 +4,7 @@
//!
//! These types are thin wrappers around `u32`, no invariants implemented or implied.
//!
-//! These are general types for abstracting over block heights, they are not designed to use with
+//! These are general types for abstracting over block heights, they are not designed for use with
//! lock times. If you are creating lock times you should be using the
//! [`locktime::absolute::Height`] and [`locktime::relative::NumberOfBlocks`] types.
//!
@@ -345,7 +345,7 @@ impl BlockMtp {
#[inline]
pub const fn to_u32(self) -> u32 { self.0 }
- /// Constructs a [`BlockMtp`] by computing the median‐time‐past from the last 11 block timestamps
+ /// Constructs a [`BlockMtp`] by computing the median-time-past from the last 11 block timestamps.
///
/// Because block timestamps are not monotonic, this function internally sorts them;
/// it is therefore not important what order they appear in the array; use whatever
@@ -663,7 +663,7 @@ pub mod error {
}
}
- /// An error consensus decoding an `BlockHeight`.
+ /// An error consensus decoding a `BlockHeight`.
#[cfg(feature = "encoding")]
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct BlockHeightDecoderError(pub(super) encoding::UnexpectedEofError);
diff --git a/units/src/locktime/absolute/error.rs b/units/src/locktime/absolute/error.rs
index 8115aa75..ff905347 100644
--- a/units/src/locktime/absolute/error.rs
+++ b/units/src/locktime/absolute/error.rs
@@ -12,7 +12,7 @@ use internals::write_err;
use super::{Height, MedianTimePast, LOCK_TIME_THRESHOLD};
use crate::parse_int::{ParseIntError, PrefixedHexError, UnprefixedHexError};
-/// An error consensus decoding an `LockTime`.
+/// An error consensus decoding a `LockTime`.
#[cfg(feature = "encoding")]
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct LockTimeDecoderError(pub(super) encoding::UnexpectedEofError);
diff --git a/units/src/locktime/absolute/mod.rs b/units/src/locktime/absolute/mod.rs
index 214985c3..ef5571ef 100644
--- a/units/src/locktime/absolute/mod.rs
+++ b/units/src/locktime/absolute/mod.rs
@@ -53,7 +53,7 @@ pub const LOCK_TIME_THRESHOLD: u32 = 500_000_000;
/// ordering on locktimes. In order to compare locktimes, instead of using `<` or `>` we provide the
/// [`LockTime::is_satisfied_by`] API.
///
-/// For transaction, which has a locktime field, we implement a total ordering to make
+/// For `Transaction`, which has a locktime field, we implement a total ordering to make
/// it easy to store transactions in sorted data structures, and use the locktime's 32-bit integer
/// consensus encoding to order it.
///
@@ -170,6 +170,7 @@ impl LockTime {
/// let n_lock_time: u32 = 741521;
/// let lock_time = absolute::LockTime::from_consensus(n_lock_time);
/// assert_eq!(lock_time.to_consensus_u32(), n_lock_time);
+ /// ```
#[inline]
#[allow(clippy::missing_panics_doc)]
pub fn from_consensus(n: u32) -> Self {
@@ -284,7 +285,7 @@ impl LockTime {
/// if n.is_satisfied_by(get_height(), get_time()) {
/// // Can create and mine a transaction that satisfies the OP_CLTV timelock constraint.
/// }
- /// ````
+ /// ```
#[inline]
pub fn is_satisfied_by(self, height: Height, mtp: MedianTimePast) -> bool {
match self {
@@ -363,7 +364,7 @@ impl LockTime {
/// # Warning
///
/// Do not compare values return by this method. The whole point of the `LockTime` type is to
- /// assist in doing correct comparisons. Either use `is_satisfied_by`, `is_satisfied_by_lock`,
+ /// assist in doing correct comparisons. Either use `is_satisfied_by`, `is_satisfied_by_time`,
/// or use the pattern below:
///
/// # Examples
@@ -605,7 +606,7 @@ impl MedianTimePast {
/// The maximum MTP allowable in a locktime (Sun Feb 07 2106 06:28:15 GMT+0000).
pub const MAX: Self = Self(u32::MAX);
- /// Constructs an [`MedianTimePast`] by computing the median-time-past from the last
+ /// Constructs a [`MedianTimePast`] by computing the median-time-past from the last
/// 11 block timestamps.
///
/// Because block timestamps are not monotonic, this function internally sorts them;
@@ -650,7 +651,7 @@ impl MedianTimePast {
/// Constructs a new MTP directly from a `u32` value.
///
/// This function, with [`MedianTimePast::to_u32`], is used to obtain a raw MTP value. It is
- /// **not** used to convert to or from a block timestamp, which is not a MTP.
+ /// **not** used to convert to or from a block timestamp, which is not an MTP.
///
/// # Errors
///
diff --git a/units/src/locktime/relative/mod.rs b/units/src/locktime/relative/mod.rs
index a704d8e9..5cc4dd11 100644
--- a/units/src/locktime/relative/mod.rs
+++ b/units/src/locktime/relative/mod.rs
@@ -200,7 +200,7 @@ impl LockTime {
///
/// # Errors
///
- /// If `chain_tip` as not _after_ `utxo_mined_at` i.e., if you get the args mixed up.
+ /// If `chain_tip` is not _after_ `utxo_mined_at` i.e., if you get the args mixed up.
#[inline]
pub fn is_satisfied_by(
self,
@@ -440,7 +440,7 @@ impl NumberOfBlocks {
///
/// # Errors
///
- /// If `chain_tip` as not _after_ `utxo_mined_at` i.e., if you get the args mixed up.
+ /// If `chain_tip` is not _after_ `utxo_mined_at` i.e., if you get the args mixed up.
pub fn is_satisfied_by(
self,
chain_tip: crate::BlockHeight,
@@ -568,7 +568,7 @@ impl NumberOf512Seconds {
///
/// # Errors
///
- /// If `chain_tip` as not _after_ `utxo_mined_at` i.e., if you get the args mixed up.
+ /// If `chain_tip` is not _after_ `utxo_mined_at` i.e., if you get the args mixed up.
pub fn is_satisfied_by(
self,
chain_tip: crate::BlockMtp,
diff --git a/units/src/pow.rs b/units/src/pow.rs
index 4e3974c6..46b99d14 100644
--- a/units/src/pow.rs
+++ b/units/src/pow.rs
@@ -345,7 +345,7 @@ pub mod error {
use super::ParseU256Error;
- /// An error consensus decoding an `CompactTarget`.
+ /// An error consensus decoding a `CompactTarget`.
#[derive(Debug, Clone, PartialEq, Eq)]
#[cfg(feature = "encoding")]
pub struct CompactTargetDecoderError(pub(super) encoding::UnexpectedEofError);
diff --git a/units/src/result.rs b/units/src/result.rs
index f783481a..b209f516 100644
--- a/units/src/result.rs
+++ b/units/src/result.rs
@@ -37,7 +37,7 @@ pub use self::error::NumOpError;
/// // And another value from some other UTXO.
/// let a2 = Amount::from_sat(765_432)?;
/// // Just an example (typically one would calculate fee using weight and fee rate).
-/// let fee = Amount::from_sat(1_00)?;
+/// let fee = Amount::from_sat(100)?;
/// // The amount we want to send.
/// let spend = Amount::from_sat(1_200_000)?;
///
diff --git a/units/src/sequence.rs b/units/src/sequence.rs
index fdb971be..66223acf 100644
--- a/units/src/sequence.rs
+++ b/units/src/sequence.rs
@@ -157,7 +157,7 @@ impl Sequence {
/// Constructs a new relative lock-time using time intervals where each interval is equivalent
/// to 512 seconds.
///
- /// Encoding finer granularity of time for relative lock-times is not supported in Bitcoin
+ /// Encoding finer granularity of time for relative lock-times is not supported in Bitcoin.
#[inline]
pub fn from_512_second_intervals(intervals: u16) -> Self {
Self(u32::from(intervals) | Self::LOCK_TYPE_MASK)
@@ -197,7 +197,7 @@ impl Sequence {
#[inline]
pub fn from_consensus(n: u32) -> Self { Self(n) }
- /// Returns the inner 32bit integer value of Sequence.
+ /// Returns the inner 32-bit integer value of Sequence.
#[inline]
pub const fn to_consensus_u32(self) -> u32 { self.0 }
@@ -303,7 +303,7 @@ pub mod error {
#[cfg(feature = "encoding")]
use internals::write_err;
- /// An error consensus decoding an `Sequence`.
+ /// An error consensus decoding a `Sequence`.
#[cfg(feature = "encoding")]
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct SequenceDecoderError(pub(super) encoding::UnexpectedEofError);
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.