Skip to content

Commit 7dfa886

Browse files
authored
Merge pull request #1032 from jkczyz/2021-08-clippy
2 parents bee9a1e + b4c3a33 commit 7dfa886

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

.github/workflows/build.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -262,4 +262,4 @@ jobs:
262262
rustup component add clippy
263263
- name: Run default clippy linting
264264
run: |
265-
cargo clippy -- -Aclippy::erasing_op -Aclippy::never_loop -Aclippy::if_same_then_else
265+
cargo clippy -- -Aclippy::erasing_op -Aclippy::never_loop -Aclippy::if_same_then_else -Dclippy::try_err

lightning/src/util/ser_macros.rs

+9-9
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ macro_rules! check_tlv_order {
9393
#[allow(unused_comparisons)] // Note that $type may be 0 making the second comparison always true
9494
let invalid_order = ($last_seen_type.is_none() || $last_seen_type.unwrap() < $type) && $typ.0 > $type;
9595
if invalid_order {
96-
Err(DecodeError::InvalidValue)?
96+
return Err(DecodeError::InvalidValue);
9797
}
9898
}};
9999
($last_seen_type: expr, $typ: expr, $type: expr, option) => {{
@@ -109,7 +109,7 @@ macro_rules! check_missing_tlv {
109109
#[allow(unused_comparisons)] // Note that $type may be 0 making the second comparison always true
110110
let missing_req_type = $last_seen_type.is_none() || $last_seen_type.unwrap() < $type;
111111
if missing_req_type {
112-
Err(DecodeError::InvalidValue)?
112+
return Err(DecodeError::InvalidValue);
113113
}
114114
}};
115115
($last_seen_type: expr, $type: expr, vec_type) => {{
@@ -149,20 +149,20 @@ macro_rules! decode_tlv_stream {
149149
match ser::Readable::read(&mut tracking_reader) {
150150
Err(DecodeError::ShortRead) => {
151151
if !tracking_reader.have_read {
152-
break 'tlv_read
152+
break 'tlv_read;
153153
} else {
154-
Err(DecodeError::ShortRead)?
154+
return Err(DecodeError::ShortRead);
155155
}
156156
},
157-
Err(e) => Err(e)?,
157+
Err(e) => return Err(e),
158158
Ok(t) => t,
159159
}
160160
};
161161

162162
// Types must be unique and monotonically increasing:
163163
match last_seen_type {
164164
Some(t) if typ.0 <= t => {
165-
Err(DecodeError::InvalidValue)?
165+
return Err(DecodeError::InvalidValue);
166166
},
167167
_ => {},
168168
}
@@ -180,11 +180,11 @@ macro_rules! decode_tlv_stream {
180180
decode_tlv!(s, $field, $fieldty);
181181
if s.bytes_remain() {
182182
s.eat_remaining()?; // Return ShortRead if there's actually not enough bytes
183-
Err(DecodeError::InvalidValue)?
183+
return Err(DecodeError::InvalidValue);
184184
}
185185
},)*
186186
x if x % 2 == 0 => {
187-
Err(DecodeError::UnknownRequiredFeature)?
187+
return Err(DecodeError::UnknownRequiredFeature);
188188
},
189189
_ => {},
190190
}
@@ -490,7 +490,7 @@ macro_rules! impl_writeable_tlv_based_enum {
490490
Ok($st::$tuple_variant_name(Readable::read(reader)?))
491491
}),*
492492
_ => {
493-
Err(DecodeError::UnknownRequiredFeature)?
493+
Err(DecodeError::UnknownRequiredFeature)
494494
},
495495
}
496496
}

0 commit comments

Comments
 (0)