Skip to content

Commit e7e060a

Browse files
akonradi-signaldaniel-abramov
authored andcommitted
Replace if let Some(...) with .ok_or(...)?
1 parent a526829 commit e7e060a

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

src/protocol/mod.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -681,11 +681,11 @@ impl WebSocketContext {
681681
let fin = frame.header().is_final;
682682
match data {
683683
OpData::Continue => {
684-
if let Some(ref mut msg) = self.incomplete {
685-
msg.extend(frame.into_payload(), self.config.max_message_size)?;
686-
} else {
687-
return Err(Error::Protocol(ProtocolError::UnexpectedContinueFrame));
688-
}
684+
let msg = self
685+
.incomplete
686+
.as_mut()
687+
.ok_or(Error::Protocol(ProtocolError::UnexpectedContinueFrame))?;
688+
msg.extend(frame.into_payload(), self.config.max_message_size)?;
689689
if fin {
690690
Ok(Some(self.incomplete.take().unwrap().complete()?))
691691
} else {

0 commit comments

Comments
 (0)