Skip to content

Commit

Permalink
clippy
Browse files Browse the repository at this point in the history
  • Loading branch information
loocapro committed Jun 25, 2024
1 parent eef0497 commit bb25971
Showing 1 changed file with 12 additions and 11 deletions.
23 changes: 12 additions & 11 deletions examples/exex/discv5/src/exex/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,17 +27,18 @@ impl<Node: FullNodeComponents> Future for ExEx<Node> {
type Output = Result<()>;

fn poll(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Self::Output> {
// Continuously poll the Discv5 future
while let Poll::Ready(result) = Pin::new(&mut self.disc_v5).poll(cx) {
match result {
Ok(()) => {
info!("Discv5 task completed successfully");
break;
}
Err(e) => {
info!(error = ?e, "Discv5 task encountered an error");
return Poll::Ready(Err(e));
}
// Poll the Discv5 future
match Pin::new(&mut self.disc_v5).poll(cx) {
Poll::Ready(Ok(())) => {
info!("Discv5 task completed successfully");
}
Poll::Ready(Err(e)) => {
info!(error = ?e, "Discv5 task encountered an error");
return Poll::Ready(Err(e));
}
Poll::Pending => {
// If the future is still pending, we yield control back to the executor
return Poll::Pending;
}
}

Expand Down

0 comments on commit bb25971

Please sign in to comment.