Skip to content

Commit 2506e57

Browse files
authored
refactor: Bump edition to 2024 and MSRV to 1.85 (#216)
This PR will bump backon's edition to 2024 and MSRV to 1.85 so that we can support more native features like #183 --- **This PR was primarily authored with Codex using GPT-5-Codex and then hand-reviewed by me. I AM responsible for every change made in this PR. I aimed to keep it aligned with our goals, though I may have missed minor issues. Please flag anything that feels off, I'll fix it quickly.** Signed-off-by: Xuanwo <[email protected]>
1 parent dba1742 commit 2506e57

File tree

9 files changed

+17
-17
lines changed

9 files changed

+17
-17
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ concurrency:
1414

1515
env:
1616
# Minimum Supported Rust Version for backon
17-
BACKON_MSRV: "1.70"
17+
BACKON_MSRV: "1.85"
1818

1919
jobs:
2020
check:

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@ members = ["backon"]
33
resolver = "2"
44

55
[workspace.package]
6-
edition = "2021"
6+
edition = "2024"
77
license = "Apache-2.0"
88
repository = "https://github.com/Xuanwo/backon"

backon/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ description = "Make retry like a built-in feature provided by Rust."
33
documentation = "https://docs.rs/backon"
44
name = "backon"
55
readme = "../README.md"
6-
rust-version = "1.70"
6+
rust-version = "1.85"
77
version = "1.5.2"
88

99
edition.workspace = true

backon/src/backoff/exponential.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ impl Iterator for ExponentialBackoff {
237237
// Check if adding the current delay would exceed the total delay limit.
238238
let total_delay_check = self
239239
.total_delay
240-
.map_or(true, |total| self.cumulative_delay + tmp_cur <= total);
240+
.is_none_or(|total| self.cumulative_delay + tmp_cur <= total);
241241

242242
if !total_delay_check {
243243
return None;

backon/src/blocking_retry.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
use core::time::Duration;
22

3-
use crate::backoff::BackoffBuilder;
4-
use crate::blocking_sleep::MaybeBlockingSleeper;
53
use crate::Backoff;
64
use crate::BlockingSleeper;
75
use crate::DefaultBlockingSleeper;
6+
use crate::backoff::BackoffBuilder;
7+
use crate::blocking_sleep::MaybeBlockingSleeper;
88

99
/// BlockingRetryable adds retry support for blocking functions.
1010
///

backon/src/blocking_retry_with_context.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
use core::time::Duration;
22

3-
use crate::backoff::BackoffBuilder;
4-
use crate::blocking_sleep::MaybeBlockingSleeper;
53
use crate::Backoff;
64
use crate::BlockingSleeper;
75
use crate::DefaultBlockingSleeper;
6+
use crate::backoff::BackoffBuilder;
7+
use crate::blocking_sleep::MaybeBlockingSleeper;
88

99
/// BlockingRetryableWithContext adds retry support for blocking functions.
1010
pub trait BlockingRetryableWithContext<
@@ -189,8 +189,8 @@ mod tests {
189189
use alloc::string::ToString;
190190
use core::time::Duration;
191191

192-
use anyhow::anyhow;
193192
use anyhow::Result;
193+
use anyhow::anyhow;
194194
use spin::Mutex;
195195

196196
use super::*;

backon/src/retry.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
use core::future::Future;
22
use core::pin::Pin;
3-
use core::task::ready;
43
use core::task::Context;
54
use core::task::Poll;
5+
use core::task::ready;
66
use core::time::Duration;
77

8-
use crate::backoff::BackoffBuilder;
9-
use crate::sleep::MaybeSleeper;
108
use crate::Backoff;
119
use crate::DefaultSleeper;
1210
use crate::Sleeper;
11+
use crate::backoff::BackoffBuilder;
12+
use crate::sleep::MaybeSleeper;
1313

1414
/// Retryable will add retry support for functions that produce futures with results.
1515
///

backon/src/retry_with_context.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
use core::future::Future;
22
use core::pin::Pin;
3-
use core::task::ready;
43
use core::task::Context;
54
use core::task::Poll;
5+
use core::task::ready;
66
use core::time::Duration;
77

8-
use crate::backoff::BackoffBuilder;
9-
use crate::sleep::MaybeSleeper;
108
use crate::Backoff;
119
use crate::DefaultSleeper;
1210
use crate::Sleeper;
11+
use crate::backoff::BackoffBuilder;
12+
use crate::sleep::MaybeSleeper;
1313

1414
/// `RetryableWithContext` adds retry support for functions that produce futures with results
1515
/// and context.
@@ -369,8 +369,8 @@ mod tests {
369369
use alloc::string::ToString;
370370
use core::time::Duration;
371371

372-
use anyhow::anyhow;
373372
use anyhow::Result;
373+
use anyhow::anyhow;
374374
use tokio::sync::Mutex;
375375
#[cfg(not(target_arch = "wasm32"))]
376376
use tokio::test;

rustfmt.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
edition = "2021"
1+
edition = "2024"
22
reorder_imports = true
33

44
# format_code_in_doc_comments = true

0 commit comments

Comments
 (0)