Skip to content

Commit 2ce0a2f

Browse files
committed
refactor: simplify code
1 parent 3e96557 commit 2ce0a2f

File tree

1 file changed

+1
-6
lines changed

1 file changed

+1
-6
lines changed

crates/net/p2p/src/full_block.rs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -145,12 +145,7 @@ where
145145

146146
/// Returns the [`SealedBlock`] if the request is complete and valid.
147147
fn take_block(&mut self) -> Option<SealedBlock<Client::Block>> {
148-
if self.header.is_none() || self.body.is_none() {
149-
return None
150-
}
151-
152-
let header = self.header.take().unwrap();
153-
let resp = self.body.take().unwrap();
148+
let (header, resp) = (self.header.take()?, self.body.take()?);
154149
match resp {
155150
BodyResponse::Validated(body) => Some(SealedBlock::from_sealed_parts(header, body)),
156151
BodyResponse::PendingValidation(resp) => {

0 commit comments

Comments
 (0)