Skip to content

Commit 3927f7d

Browse files
jkczyzshaavan
authored andcommitted
f: Expand macro to add compile-time type check
1 parent ca40276 commit 3927f7d

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lightning/src/util/ser_macros.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ macro_rules! _encode_tlv {
4040
}
4141
};
4242
($stream: expr, $optional_type: expr, $optional_field: expr, (legacy, $fieldty: ty, $write: expr) $(, $self: ident)?) => {
43-
$crate::_encode_tlv!($stream, $optional_type, $write($($self)?), option);
43+
$crate::_encode_tlv!($stream, $optional_type, { let value: Option<$fieldty> = $write($($self)?); value }, option);
4444
};
4545
($stream: expr, $type: expr, $field: expr, optional_vec $(, $self: ident)?) => {
4646
if !$field.is_empty() {

0 commit comments

Comments
 (0)