|
160 | 160 | clippy::match_same_arms, |
161 | 161 | clippy::match_wildcard_for_single_variants, |
162 | 162 | clippy::mem_forget, |
163 | | - clippy::mismatched_target_os, |
164 | 163 | clippy::needless_borrow, |
165 | 164 | clippy::needless_continue, |
166 | 165 | clippy::option_option, |
|
175 | 174 | clippy::unnested_or_patterns, |
176 | 175 | clippy::unused_self, |
177 | 176 | clippy::verbose_file_reads, |
| 177 | + unexpected_cfgs, |
178 | 178 | future_incompatible, |
179 | 179 | nonstandard_style, |
180 | 180 | rust_2018_idioms |
|
186 | 186 | use backoff_strategies::{ |
187 | 187 | BackoffStrategy, ExponentialBackoff, FixedBackoff, LinearBackoff, NoBackoff, |
188 | 188 | }; |
189 | | -use futures::ready; |
190 | 189 | use pin_project_lite::pin_project; |
191 | 190 | use std::time::Duration; |
192 | 191 | use std::{ |
@@ -569,18 +568,19 @@ where |
569 | 568 | future: (this.make_future)(), |
570 | 569 | }, |
571 | 570 |
|
572 | | - RetryStateProj::TimerActive { sleep } => { |
573 | | - ready!(sleep.poll(cx)); |
574 | | - RetryState::WaitingForFuture { |
| 571 | + RetryStateProj::TimerActive { sleep } => match sleep.poll(cx) { |
| 572 | + Poll::Ready(()) => RetryState::WaitingForFuture { |
575 | 573 | future: (this.make_future)(), |
576 | | - } |
577 | | - } |
| 574 | + }, |
| 575 | + Poll::Pending => return Poll::Pending, |
| 576 | + }, |
578 | 577 |
|
579 | | - RetryStateProj::WaitingForFuture { future } => match ready!(future.poll(cx)) { |
580 | | - Ok(value) => { |
| 578 | + RetryStateProj::WaitingForFuture { future } => match future.poll(cx) { |
| 579 | + Poll::Pending => return Poll::Pending, |
| 580 | + Poll::Ready(Ok(value)) => { |
581 | 581 | return Poll::Ready(Ok(value)); |
582 | 582 | } |
583 | | - Err(error) => { |
| 583 | + Poll::Ready(Err(error)) => { |
584 | 584 | if *this.attempts_remaining == 0 { |
585 | 585 | if let Some(on_retry) = &mut this.config.on_retry { |
586 | 586 | tokio::spawn(on_retry.on_retry(*this.attempt, None, &error)); |
@@ -724,7 +724,7 @@ mod tests { |
724 | 724 |
|
725 | 725 | // assertions about what the exact times are are very finicky so lets just assert that the |
726 | 726 | // one without backoff is slower. |
727 | | - assert!(time_with_fixed > time_with_none); |
| 727 | + assert!(time_with_fixed >= time_with_none); |
728 | 728 | } |
729 | 729 |
|
730 | 730 | // `RetryFuture` must be `Send` to be used with `async_trait` |
|
0 commit comments