Fix rustdoc typos and grammar with three LLMs
What changed, and why it matters
This commit is a documentation-only cleanup. It fixes spelling mistakes, grammar, and typos in code comments, README files, and rustdoc strings. No executable code, logic, or security behavior was changed.
No action required. This is a safe documentation-only commit.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The diff consists entirely of non-functional changes: correcting ‘an Rust’ to ‘a Rust’, ‘can not’ to ‘cannot’, ‘serialised’ to ‘serialized’, ‘monodic’ to ‘monadic’, ‘u64::MAX’ to ‘u32::MAX’ in a comment, and similar typo/grammar fixes across 20 files. There are no changes to code paths, APIs, parsing, serialization, cryptography, or consensus logic.
Changed components
Inspect captured patch +35 / −31
diff --git a/base58/README.md b/base58/README.md
index 34b576db..ae15552f 100644
--- a/base58/README.md
+++ b/base58/README.md
@@ -8,7 +8,7 @@ obviously named ones differ from this crate because:
1. [bitcoin-base58](https://crates.io/crates/bitcoin-base58) is transpiled from the C++ code in
Bitcoin Core as part of a large long-term transpilation project, whereas this crate is a pure
- Rust implementation intended to be production-ready and to provide an Rust-idiomatic API.
+ Rust implementation intended to be production-ready and to provide a Rust-idiomatic API.
2. [base58](https://crates.io/crates/base58) implements parsing but does not validate checksums (see
`base58check`). It may be appropriate in cases where performance is more important than safety.
diff --git a/base58/src/error.rs b/base58/src/error.rs
index 2ec8f5be..1280ac8d 100644
--- a/base58/src/error.rs
+++ b/base58/src/error.rs
@@ -132,7 +132,7 @@ impl fmt::Display for TooShortError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(
f,
- "base58 decoded data was not long enough, must be at least 4 byte: {}",
+ "base58 decoded data was not long enough, must be at least 4 bytes: {}",
self.length
)
}
diff --git a/bitcoin/src/bip158.rs b/bitcoin/src/bip158.rs
index d240d1ad..88b31800 100644
--- a/bitcoin/src/bip158.rs
+++ b/bitcoin/src/bip158.rs
@@ -467,7 +467,7 @@ impl<'a, R: BufRead + ?Sized> BitStreamReader<'a, R> {
if nbits > 64 {
return Err(io::Error::new(
io::ErrorKind::Other,
- "can not read more than 64 bits at once",
+ "cannot read more than 64 bits at once",
));
}
let mut data = 0u64;
@@ -502,7 +502,7 @@ impl<'a, W: Write> BitStreamWriter<'a, W> {
if nbits > 64 {
return Err(io::Error::new(
io::ErrorKind::Other,
- "can not write more than 64 bits at once",
+ "cannot write more than 64 bits at once",
));
}
let mut wrote = 0;
diff --git a/bitcoin/src/blockdata/script/mod.rs b/bitcoin/src/blockdata/script/mod.rs
index 06643769..b48470b8 100644
--- a/bitcoin/src/blockdata/script/mod.rs
+++ b/bitcoin/src/blockdata/script/mod.rs
@@ -251,9 +251,9 @@ pub enum Error {
EarlyEndOfScript,
/// Tried to read an array off the stack as a number when it was more than 4 bytes.
NumericOverflow,
- /// Can not find the spent output.
+ /// Cannot find the spent output.
UnknownSpentOutput(OutPoint),
- /// Can not serialize the spending transaction.
+ /// Cannot serialize the spending transaction.
Serialization,
}
diff --git a/bitcoin/src/blockdata/transaction.rs b/bitcoin/src/blockdata/transaction.rs
index 5bba509d..20dd224b 100644
--- a/bitcoin/src/blockdata/transaction.rs
+++ b/bitcoin/src/blockdata/transaction.rs
@@ -283,7 +283,7 @@ pub trait TransactionExt: sealed::Sealed {
/// Returns the base transaction size.
///
- /// > Base transaction size is the size of the transaction serialised with the witness data stripped.
+ /// > Base transaction size is the size of the transaction serialized with the witness data stripped.
///
/// # Panics
///
diff --git a/bitcoin/src/consensus_validation.rs b/bitcoin/src/consensus_validation.rs
index a998e602..e3d02d9f 100644
--- a/bitcoin/src/consensus_validation.rs
+++ b/bitcoin/src/consensus_validation.rs
@@ -234,7 +234,7 @@ impl std::error::Error for BitcoinconsensusError {
pub enum TxVerifyError {
/// Error validating the script with bitcoinconsensus library.
ScriptVerification(BitcoinconsensusError),
- /// Can not find the spent output.
+ /// Cannot find the spent output.
UnknownSpentOutput(OutPoint),
}
diff --git a/bitcoin/src/crypto/sighash.rs b/bitcoin/src/crypto/sighash.rs
index 5b300515..2755f824 100644
--- a/bitcoin/src/crypto/sighash.rs
+++ b/bitcoin/src/crypto/sighash.rs
@@ -438,7 +438,7 @@ impl EcdsaSighashType {
/// Constructs a new [`EcdsaSighashType`] from a raw `u32`.
///
- /// **Note**: this replicates consensus behaviour, for current standardness rules correctness
+ /// **Note**: this replicates consensus behavior, for current standardness rules correctness
/// you probably want [`Self::from_standard`].
///
/// This might cause unexpected behavior because it does not roundtrip. That is,
@@ -959,7 +959,7 @@ impl<R: Borrow<Transaction>> SighashCache<R> {
// We cannot correctly handle the SIGHASH_SINGLE bug here because usage of this function
// will result in the data written to the writer being hashed, however the correct
// handling of the SIGHASH_SINGLE bug is to return the 'one array' - either implement
- // this behaviour manually or use `signature_hash()`.
+ // this behavior manually or use `signature_hash()`.
return EncodeSigningDataResult::SighashSingleBug;
}
diff --git a/bitcoin/src/lib.rs b/bitcoin/src/lib.rs
index 525814a3..50356fef 100644
--- a/bitcoin/src/lib.rs
+++ b/bitcoin/src/lib.rs
@@ -93,14 +93,14 @@ pub mod ext {
//! Re-export all the extension traits so downstream can use wildcard imports.
//!
//! As part of stabilizing `primitives` and `units` we created a bunch of extension traits in
- //! `rust-bitcoin` to hold all then API that we are not yet ready to stabilize. This module
+ //! `rust-bitcoin` to hold all the API that we are not yet ready to stabilize. This module
//! re-exports all of them to improve ergonomics for users comfortable with wildcard imports.
//!
//! # Examples
//!
//! ```
//! # #![allow(unused_imports)] // Because that is what we are demoing.
- //! // Wildcard import all of the extension crates.
+ //! // Wildcard import all of the extension traits.
//! use bitcoin::ext::*;
//!
//! // If, for some reason, you want the name to be in scope access it via the module. E.g.
diff --git a/bitcoin/src/merkle_tree/block.rs b/bitcoin/src/merkle_tree/block.rs
index 0fdcf89b..9cef0bee 100644
--- a/bitcoin/src/merkle_tree/block.rs
+++ b/bitcoin/src/merkle_tree/block.rs
@@ -185,13 +185,14 @@ impl PartialMerkleTree {
/// Returns the transaction ids and internal hashes of the partial Merkle tree.
pub fn hashes(&self) -> &Vec<TxMerkleNode> { &self.hashes }
- /// Constructs a new partial Merkle tree
- /// The `txids` are the transaction hashes of the block and the `matches` is the contains flags
- /// wherever a tx hash should be included in the proof.
+ /// Constructs a new partial Merkle tree.
+ ///
+ /// The `txids` are the transaction hashes of the block and `matches` contains flags indicating
+ /// whether each txid should be included in the proof.
///
/// # Panics
///
- /// Panics when `txids` is empty or when `matches` has a different length
+ /// Panics when `txids` is empty or when `matches` has a different length.
///
/// # Examples
///
diff --git a/bitcoin/src/psbt/map/mod.rs b/bitcoin/src/psbt/map/mod.rs
index 58c28699..820ab40e 100644
--- a/bitcoin/src/psbt/map/mod.rs
+++ b/bitcoin/src/psbt/map/mod.rs
@@ -24,9 +24,12 @@ pub(super) trait Map {
///
/// <map> := <keypair>* 0x00
///
- /// Why is the separator here 0x00 instead of 0xff? The separator here is used to distinguish between each chunk of data.
- /// A separator of 0x00 would mean that the unserializer can read it as a key length of 0, which would never occur with
- /// actual keys. It can thus be used as a separator and allow for easier unserializer implementation.
+ /// Why is the separator here 0x00 instead of 0xff? The separator here is used to distinguish
+ /// between each chunk of data.
+ ///
+ /// A separator of 0x00 would mean that the deserializer can read it as a key length of 0,
+ /// which would never occur with actual keys. It can thus be used as a separator and allow for
+ /// easier deserializer implementation.
fn serialize_map(&self) -> Vec<u8> {
let mut buf = Vec::new();
for pair in Map::get_pairs(self) {
diff --git a/bitcoin/src/taproot/mod.rs b/bitcoin/src/taproot/mod.rs
index 32835a4e..d2d8e842 100644
--- a/bitcoin/src/taproot/mod.rs
+++ b/bitcoin/src/taproot/mod.rs
@@ -458,7 +458,7 @@ impl TaprootBuilder {
let (p1, s1) = node_weights.pop().expect("len must be at least two");
let (p2, s2) = node_weights.pop().expect("len must be at least two");
// Insert the sum of first two in the tree as a new node
- // N.B.: p1 + p2 can not practically saturate as you would need to have 2**32 max u32s
+ // N.B.: p1 + p2 cannot practically saturate as you would need to have 2**32 max u32s
// from the input to overflow. However, saturating is a reasonable behavior here as
// Huffman tree construction would treat all such elements as "very likely".
let p = Reverse(p1.0.saturating_add(p2.0));
@@ -1163,7 +1163,7 @@ impl ControlBlock {
///
/// This is an extra witness element that provides the proof that Taproot script pubkey is
/// correctly computed with some specified leaf hash. This is the last element in Taproot
- /// witness when spending a output via script path.
+ /// witness when spending an output via script path.
///
/// # Errors
///
diff --git a/bitcoin/tests/network.rs b/bitcoin/tests/network.rs
index 2b272721..33ae115e 100644
--- a/bitcoin/tests/network.rs
+++ b/bitcoin/tests/network.rs
@@ -23,7 +23,7 @@ fn can_use_network_kind() {
// Returns true if `n` is any mainnet.
fn is_mainnet(n: Network) -> bool { NetworkKind::from(n).is_mainnet() }
- // Returns true if `n` is a any testnet.
+ // Returns true if `n` is any testnet.
fn is_testnet(n: Network) -> bool { !NetworkKind::from(n).is_mainnet() }
assert!(is_mainnet(Network::Bitcoin));
diff --git a/docs/README.md b/docs/README.md
index 9d90c1bc..4f6c691d 100644
--- a/docs/README.md
+++ b/docs/README.md
@@ -1,7 +1,7 @@
# rust-bitcoin documentation
This directory holds documentation for the `rust-bitcoin` repository and potentially various other
-directly related crates from the `rust-bitcoin` GitHub organisation (e.g. `rust-secp256k1`).
+directly related crates from the `rust-bitcoin` GitHub organization (e.g. `rust-secp256k1`).
In general, PR discussions on source code should be about the technical content of changes. To debate
whether a change should be made at all, or the strategy for making changes, it is better to first PR to
diff --git a/docs/policy.md b/docs/policy.md
index 9b6b7332..83c27a35 100644
--- a/docs/policy.md
+++ b/docs/policy.md
@@ -309,7 +309,7 @@ warnings.
### Links
-We favour links at the bottom of the docs section:
+We favor links at the bottom of the docs section:
```rust
/// it is a real Taproot script spend (and not some other kind of output contrived
diff --git a/io/src/lib.rs b/io/src/lib.rs
index 15201bca..829738c2 100644
--- a/io/src/lib.rs
+++ b/io/src/lib.rs
@@ -122,7 +122,7 @@ pub trait BufRead: Read {
///
/// # Panics
///
- /// May panic if `amount` is greater than amount of data read by `fill_buf`.
+ /// May panic if `amount` is greater than the amount of data read by `fill_buf`.
fn consume(&mut self, amount: usize);
}
@@ -665,7 +665,7 @@ mod tests {
let v = [1_u8; BUF_LEN];
- // Sanity check the stdlib Cursor's behaviour.
+ // Sanity check the stdlib Cursor's behavior.
let mut c = std::io::Cursor::new(v);
for pos in [BUF_LEN, BUF_LEN + 1, BUF_LEN * 2] {
c.set_position(pos as u64);
diff --git a/primitives/src/lib.rs b/primitives/src/lib.rs
index e95963c7..65f8d546 100644
--- a/primitives/src/lib.rs
+++ b/primitives/src/lib.rs
@@ -10,7 +10,7 @@
//! This crate can be used in a no-std environment but a lot of the functionality requires an
//! allocator i.e., requires the `alloc` feature to be enabled.
//!
-//! [`rust-bitcoin`]: <https://github.com/rust-bitcoin>
+//! [`rust-bitcoin`]: <https://github.com/rust-bitcoin/rust-bitcoin>
#![no_std]
// Coding conventions.
diff --git a/primitives/src/script/owned.rs b/primitives/src/script/owned.rs
index ea8dbc15..ffe68bc5 100644
--- a/primitives/src/script/owned.rs
+++ b/primitives/src/script/owned.rs
@@ -105,7 +105,7 @@ impl<T> ScriptBuf<T> {
/// `self.len() + additional`. Does nothing if the capacity is already sufficient.
///
/// Note that the allocator may give the collection more space than it requests. Therefore,
- /// capacity can not be relied upon to be precisely minimal. Prefer [`reserve`](Self::reserve)
+ /// capacity cannot be relied upon to be precisely minimal. Prefer [`reserve`](Self::reserve)
/// if future insertions are expected.
///
/// # Panics
diff --git a/units/src/amount/result.rs b/units/src/amount/result.rs
index 55135a80..723fbae1 100644
--- a/units/src/amount/result.rs
+++ b/units/src/amount/result.rs
@@ -1,6 +1,6 @@
// SPDX-License-Identifier: CC0-1.0
-//! Provides a monodic type returned by mathematical operations (`core::ops`).
+//! Provides a monadic type returned by mathematical operations (`core::ops`).
use core::num::{NonZeroI64, NonZeroU64};
use core::ops;
diff --git a/units/src/result.rs b/units/src/result.rs
index 2c1881d3..3f33011b 100644
--- a/units/src/result.rs
+++ b/units/src/result.rs
@@ -1,6 +1,6 @@
// SPDX-License-Identifier: CC0-1.0
-//! Provides a monodic type returned by mathematical operations (`core::ops`).
+//! Provides a monadic type returned by mathematical operations (`core::ops`).
use core::convert::Infallible;
use core::{fmt, ops};
diff --git a/units/src/sequence.rs b/units/src/sequence.rs
index 321c63e5..aec14a03 100644
--- a/units/src/sequence.rs
+++ b/units/src/sequence.rs
@@ -87,7 +87,7 @@ impl Sequence {
///
/// The term 'final' is an archaic Bitcoin term, it may have come about because the sequence
/// number in the original Bitcoin code was intended to be incremented in order to replace a
- /// transaction, so once the sequence number got to `u64::MAX` it could no longer be increased,
+ /// transaction, so once the sequence number got to `u32::MAX` it could no longer be increased,
/// hence it was 'final'.
///
///
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.