Skip to content

Commit d5a621e

Browse files
committed
chore: fix some comments to improve readability
Signed-off-by: weifanglab <weifanglab@outlook.com>
1 parent 8ff1ce3 commit d5a621e

5 files changed

Lines changed: 12 additions & 12 deletions

File tree

src/lib.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -314,7 +314,7 @@ pub fn encode_lower_to_fmt<Ck: Checksum, W: fmt::Write>(
314314
Ok(())
315315
}
316316

317-
/// Encodes `data` to a writer ([`fmt::Write`]) as a uppercase bech32 encoded string.
317+
/// Encodes `data` to a writer ([`fmt::Write`]) as an uppercase bech32 encoded string.
318318
///
319319
/// Encoded string will be prefixed with the `hrp` and have a checksum appended as specified by the
320320
/// `Ck` algorithm (`NoChecksum` to exclude checksum all together).
@@ -399,7 +399,7 @@ pub fn encode_lower_to_writer<Ck: Checksum, W: std::io::Write>(
399399
Ok(())
400400
}
401401

402-
/// Encodes `data` to a writer ([`io::Write`]) as a uppercase bech32 encoded string.
402+
/// Encodes `data` to a writer ([`io::Write`]) as an uppercase bech32 encoded string.
403403
///
404404
/// Encoded string will be prefixed with the `hrp` and have a checksum appended as specified by the
405405
/// `Ck` algorithm (`NoChecksum` to exclude checksum all together).
@@ -757,7 +757,7 @@ mod tests {
757757

758758
#[test]
759759
fn can_decode_segwit_too_long_string() {
760-
// A 91 character long string, greater than the segwit enforced maximum of 90.
760+
// A 91 character long string, greater than the segwit enforced maximum of 90.
761761
let s = "abcd1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqrw9z3s";
762762
assert!(decode(s).is_ok());
763763
}

src/primitives/correction.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ pub struct Corrector<Ck: Checksum> {
139139

140140
impl<Ck: Checksum> Corrector<Ck> {
141141
/// A bound on the number of errors and erasures (errors with known location)
142-
/// can be corrected by this corrector.
142+
/// that can be corrected by this corrector.
143143
///
144144
/// Returns N such that, given E errors and X erasures, correction is possible
145145
/// iff 2E + X <= N.
@@ -288,7 +288,7 @@ impl<Ck: Checksum> Iterator for ErrorIterator<'_, Ck> {
288288
// (a^i)^(c - 1)) locator_derivative(a^-i)
289289
//
290290
// where here a is `Ck::ROOT_GENERATOR`, c is the first element of the range
291-
// `Ck::ROOT_EXPONENTS`, and both evalutor and locator_derivative are polynomials
291+
// `Ck::ROOT_EXPONENTS`, and both evaluator and locator_derivative are polynomials
292292
// which are computed when constructing the ErrorIterator.
293293

294294
let a_i = self.a.powi(neg_i as i64);

src/primitives/decode.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ const SEP: char = '1';
109109
/// } else if unchecked.has_valid_checksum::<Bech32m>() {
110110
/// // Remove the checksum and do something with the data as above.
111111
/// } else {
112-
/// // Checksum is not valid for either the bech32 or bech32 checksum algorithms.
112+
/// // Checksum is not valid for either the bech32 or bech32m checksum algorithms.
113113
/// }
114114
/// ```
115115
#[derive(Debug)]
@@ -125,7 +125,7 @@ pub struct UncheckedHrpstring<'s> {
125125
}
126126

127127
impl<'s> UncheckedHrpstring<'s> {
128-
/// Parses an bech32 encode string and constructs a [`UncheckedHrpstring`] object.
128+
/// Parses an bech32 encode string and constructs an [`UncheckedHrpstring`] object.
129129
///
130130
/// Checks for valid ASCII values, does not validate the checksum.
131131
#[inline]
@@ -279,7 +279,7 @@ impl<'s> UncheckedHrpstring<'s> {
279279
Ok(())
280280
}
281281

282-
/// Removes the checksum for the `Ck` algorithm and returns an [`CheckedHrpstring`].
282+
/// Removes the checksum for the `Ck` algorithm and returns a [`CheckedHrpstring`].
283283
///
284284
/// Data must be valid (ie, first call `has_valid_checksum` or `validate_checksum()`). This
285285
/// function is typically paired with `has_valid_checksum` when validating against multiple
@@ -329,7 +329,7 @@ pub struct CheckedHrpstring<'s> {
329329
hrp: Hrp,
330330
/// This is ASCII byte values of the parsed string, guaranteed to be valid bech32 characters.
331331
///
332-
/// The characters after the '1' separator and the before the checksum.
332+
/// The characters after the '1' separator and before the checksum.
333333
ascii: &'s [u8],
334334
/// The length of the parsed hrpstring.
335335
hrpstring_length: usize, // Guaranteed to be <= CK::CODE_LENGTH

src/primitives/lfsr.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ mod tests {
235235
// the "2L <= N" path with x != L.
236236
LfsrIter::berlekamp_massey(&[Fe32::Q, Fe32::Y, Fe32::H]).take(10).count();
237237

238-
// Hits the the "2L <= N" path with x != L, without overflowing subtraction
238+
// Hits the "2L <= N" path with x != L, without overflowing subtraction
239239
// as in the above vector.
240240
let sequence: Vec<_> =
241241
LfsrIter::berlekamp_massey(&[Fe32::Y, Fe32::H, Fe32::Q, Fe32::Q]).take(10).collect();
@@ -254,7 +254,7 @@ mod tests {
254254
// This vector specifically exercises the Step 5 update path
255255
// Step 5 runs when old_conn.len() + x > conn.len()
256256
// where old_conn is multiplied into the update term
257-
// replacing '*' with '/' there changes output.
257+
// replacing '*' with '/' there changes output.
258258
let step5_sequence: Vec<_> =
259259
LfsrIter::berlekamp_massey(&[Fe32::A, Fe32::C, Fe32::A, Fe32::Y, Fe32::A])
260260
.take(4)

src/primitives/polynomial.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,7 @@ impl<F: Field> Polynomial<F> {
256256
// search them. In practice this doesn't matter because we have
257257
// such a small number of roots (it may actually be faster than
258258
// using a hashset) and because the root-finding takes such a
259-
// long time that noboby can use this method in a loop anyway.
259+
// long time that nobody can use this method in a loop anyway.
260260
let mut len = 2;
261261
while let Ok(k) = roots[..].binary_search(&((r2 + ratio) % E::MULTIPLICATIVE_ORDER))
262262
{

0 commit comments

Comments
 (0)