Skip to content

Commit d76efd7

Browse files
committed
fix(listen): collapse if into match guard to satisfy clippy 1.95
clippy 1.95 flags the nested `if !partial_frame.is_empty()` inside the `OpCode::Data(Data::Continue)` arm as collapsible into a match guard. Apply the suggested form in both flux.rs and websocket.rs. Behavior is unchanged: when partial_frame is empty, the original code's inner `if` skipped its body (net no-op); the new guard fails, falls through to the `_ =>` "ignore" arm (same net no-op).
1 parent 5d4d4f6 commit d76efd7

2 files changed

Lines changed: 8 additions & 12 deletions

File tree

src/listen/flux.rs

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -432,12 +432,10 @@ async fn run_flux_worker(
432432
OpCode::Data(Data::Text) => {
433433
partial_frame.extend(frame.payload());
434434
}
435-
OpCode::Data(Data::Continue) => {
436-
// We know we're continuing a text frame because otherwise
437-
// partial_frame would be empty.
438-
if !partial_frame.is_empty() {
439-
partial_frame.extend(frame.payload())
440-
}
435+
// We know we're continuing a text frame because otherwise
436+
// partial_frame would be empty.
437+
OpCode::Data(Data::Continue) if !partial_frame.is_empty() => {
438+
partial_frame.extend(frame.payload())
441439
}
442440
_ => {
443441
// Ignore other partial frames.

src/listen/websocket.rs

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -533,12 +533,10 @@ async fn run_worker(
533533
OpCode::Data(Data::Text) => {
534534
partial_frame.extend(frame.payload());
535535
}
536-
OpCode::Data(Data::Continue) => {
537-
// We know we're continuing a text frame because otherwise
538-
// partial_frame would be empty.
539-
if !partial_frame.is_empty() {
540-
partial_frame.extend(frame.payload())
541-
}
536+
// We know we're continuing a text frame because otherwise
537+
// partial_frame would be empty.
538+
OpCode::Data(Data::Continue) if !partial_frame.is_empty() => {
539+
partial_frame.extend(frame.payload())
542540
}
543541
_ => {
544542
// Ignore other partial frames.

0 commit comments

Comments
 (0)