@@ -54,7 +54,7 @@ macro_rules! encode_tlv_stream {
54
54
let mut last_seen: Option <u64 > = None ;
55
55
$(
56
56
if let Some ( t) = last_seen {
57
- #[ allow( unused_comparisons) ] // Note that $type may be 0 making the following comparison always true
57
+ #[ allow( unused_comparisons) ] // Note that $type may be 0 making the following comparison always false
58
58
( debug_assert!( $type > t) )
59
59
}
60
60
last_seen = Some ( $type) ;
@@ -106,14 +106,14 @@ macro_rules! encode_varint_length_prefixed_tlv {
106
106
#[ macro_export]
107
107
macro_rules! check_tlv_order {
108
108
( $last_seen_type: expr, $typ: expr, $type: expr, $field: ident, ( default_value, $default: expr) ) => { {
109
- #[ allow( unused_comparisons) ] // Note that $type may be 0 making the second comparison always true
109
+ #[ allow( unused_comparisons) ] // Note that $type may be 0 making the second comparison always false
110
110
let invalid_order = ( $last_seen_type. is_none( ) || $last_seen_type. unwrap( ) < $type) && $typ. 0 > $type;
111
111
if invalid_order {
112
112
$field = $default;
113
113
}
114
114
} } ;
115
115
( $last_seen_type: expr, $typ: expr, $type: expr, $field: ident, required) => { {
116
- #[ allow( unused_comparisons) ] // Note that $type may be 0 making the second comparison always true
116
+ #[ allow( unused_comparisons) ] // Note that $type may be 0 making the second comparison always false
117
117
let invalid_order = ( $last_seen_type. is_none( ) || $last_seen_type. unwrap( ) < $type) && $typ. 0 > $type;
118
118
if invalid_order {
119
119
return Err ( DecodeError :: InvalidValue ) ;
@@ -134,14 +134,14 @@ macro_rules! check_tlv_order {
134
134
#[ macro_export]
135
135
macro_rules! check_missing_tlv {
136
136
( $last_seen_type: expr, $type: expr, $field: ident, ( default_value, $default: expr) ) => { {
137
- #[ allow( unused_comparisons) ] // Note that $type may be 0 making the second comparison always true
137
+ #[ allow( unused_comparisons) ] // Note that $type may be 0 making the second comparison always false
138
138
let missing_req_type = $last_seen_type. is_none( ) || $last_seen_type. unwrap( ) < $type;
139
139
if missing_req_type {
140
140
$field = $default;
141
141
}
142
142
} } ;
143
143
( $last_seen_type: expr, $type: expr, $field: ident, required) => { {
144
- #[ allow( unused_comparisons) ] // Note that $type may be 0 making the second comparison always true
144
+ #[ allow( unused_comparisons) ] // Note that $type may be 0 making the second comparison always false
145
145
let missing_req_type = $last_seen_type. is_none( ) || $last_seen_type. unwrap( ) < $type;
146
146
if missing_req_type {
147
147
return Err ( DecodeError :: InvalidValue ) ;
0 commit comments