Skip to content

Commit 1f1e432

Browse files
committed
Additional fixes from tnull review
1 parent 59dce84 commit 1f1e432

File tree

3 files changed

+14
-11
lines changed

3 files changed

+14
-11
lines changed

lightning/src/ln/msgs.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -821,8 +821,8 @@ pub struct CommitmentUpdate {
821821
}
822822

823823
/// Messages could have optional fields to use with extended features
824-
/// As we wish to serialize these differently from Option<T>s (Options get a tag byte, but
825-
/// OptionalField simply gets Present if there are enough bytes to read into it), we have a
824+
/// As we wish to serialize these differently from `Option<T>`s (`Options` get a tag byte, but
825+
/// [`OptionalField`] simply gets `Present` if there are enough bytes to read into it), we have a
826826
/// separate enum type for them.
827827
/// (C-not exported) due to a free generic in T
828828
#[derive(Clone, Debug, PartialEq, Eq)]

lightning/src/util/ser.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -93,15 +93,15 @@ impl Writer for LengthCalculatingWriter {
9393
}
9494
}
9595

96-
/// Essentially std::io::Take but a bit simpler and with a method to walk the underlying stream
96+
/// Essentially [`std::io::Take`] but a bit simpler and with a method to walk the underlying stream
9797
/// forward to ensure we always consume exactly the fixed length specified.
9898
pub struct FixedLengthReader<R: Read> {
9999
read: R,
100100
bytes_read: u64,
101101
total_bytes: u64,
102102
}
103103
impl<R: Read> FixedLengthReader<R> {
104-
/// Returns a new FixedLengthReader.
104+
/// Returns a new [`FixedLengthReader`].
105105
pub fn new(read: R, total_bytes: u64) -> Self {
106106
Self { read, bytes_read: 0, total_bytes }
107107
}
@@ -148,15 +148,15 @@ impl<R: Read> LengthRead for FixedLengthReader<R> {
148148
}
149149
}
150150

151-
/// A Read which tracks whether any bytes have been read at all. This allows us to distinguish
151+
/// A [`Read`] implementation which tracks whether any bytes have been read at all. This allows us to distinguish
152152
/// between "EOF reached before we started" and "EOF reached mid-read".
153153
pub struct ReadTrackingReader<R: Read> {
154154
read: R,
155-
/// Tells whether we have read from this reader or not yet.
155+
/// Returns whether we have read from this reader or not yet.
156156
pub have_read: bool,
157157
}
158158
impl<R: Read> ReadTrackingReader<R> {
159-
/// Returns a new ReadTrackingReader.
159+
/// Returns a new [`ReadTrackingReader`].
160160
pub fn new(read: R) -> Self {
161161
Self { read, have_read: false }
162162
}

lightning/src/util/ser_macros.rs

+7-4
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,11 @@
77
// You may not use this file except in accordance with one or both of these
88
// licenses.
99

10-
//! Some macros that implement Readable/Writeable traits for lightning messages.
10+
//! Some macros that implement [`Readable`]/[`Writeable`] traits for lightning messages.
1111
//! They also handle serialization and deserialization of TLVs.
12+
//!
13+
//! [`Readable`]: crate::util::ser::Readable
14+
//! [`Writeable`]: crate::util::ser::Writeable
1215
1316
/// Implements serialization for a single TLV record.
1417
/// This is exported for use by other exported macros, do not use directly.
@@ -406,7 +409,7 @@ macro_rules! _decode_tlv_stream_range {
406409
},
407410
_ => {},
408411
}
409-
// As we read types, make sure we hit every required type between last_seen_type and typ:
412+
// As we read types, make sure we hit every required type between `last_seen_type` and `typ`:
410413
$({
411414
$crate::_check_decoded_tlv_order!(last_seen_type, typ, $type, $field, $fieldty);
412415
})*
@@ -504,7 +507,7 @@ macro_rules! impl_writeable {
504507
/// serialized object. Previous versions will simply err with a
505508
/// [`DecodeError::UnknownVersion`].
506509
///
507-
/// Updates to either $this_version or $min_version_that_can_read_this should be included in
510+
/// Updates to either `$this_version` or `$min_version_that_can_read_this` should be included in
508511
/// release notes.
509512
///
510513
/// Both version fields can be specific to this type of object.
@@ -536,7 +539,7 @@ macro_rules! write_tlv_fields {
536539

537540
/// Reads a prefix added by [`write_ver_prefix`], above. Takes the current version of the
538541
/// serialization logic for this object. This is compared against the
539-
/// $min_version_that_can_read_this added by [`write_ver_prefix`].
542+
/// `$min_version_that_can_read_this` added by [`write_ver_prefix`].
540543
macro_rules! read_ver_prefix {
541544
($stream: expr, $this_version: expr) => { {
542545
let ver: u8 = Readable::read($stream)?;

0 commit comments

Comments
 (0)