Skip to content

Commit 0d3d192

Browse files
authored
fix: relax bounds on with_tokio_rt (#569)
1 parent 0c26ecf commit 0d3d192

File tree

4 files changed

+8
-3
lines changed

4 files changed

+8
-3
lines changed

actix-rt/CHANGES.md

+1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
## 2.10.0
66

7+
- Relax bound (`F: Fn -> FnOnce`) on `{Arbiter, System}::with_tokio_rt()` functions.
78
- Update `tokio-uring` dependency to `0.5`.
89
- Minimum supported Rust version (MSRV) is now 1.70.
910

actix-rt/src/arbiter.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ impl Arbiter {
109109
#[cfg(not(all(target_os = "linux", feature = "io-uring")))]
110110
pub fn with_tokio_rt<F>(runtime_factory: F) -> Arbiter
111111
where
112-
F: Fn() -> tokio::runtime::Runtime + Send + 'static,
112+
F: FnOnce() -> tokio::runtime::Runtime + Send + 'static,
113113
{
114114
let sys = System::current();
115115
let system_id = sys.id();

actix-rt/src/system.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ impl System {
4848
/// [tokio-runtime]: tokio::runtime::Runtime
4949
pub fn with_tokio_rt<F>(runtime_factory: F) -> SystemRunner
5050
where
51-
F: Fn() -> tokio::runtime::Runtime,
51+
F: FnOnce() -> tokio::runtime::Runtime,
5252
{
5353
let (stop_tx, stop_rx) = oneshot::channel();
5454
let (sys_tx, sys_rx) = mpsc::unbounded_channel();
@@ -87,7 +87,7 @@ impl System {
8787
#[doc(hidden)]
8888
pub fn with_tokio_rt<F>(_: F) -> SystemRunner
8989
where
90-
F: Fn() -> tokio::runtime::Runtime,
90+
F: FnOnce() -> tokio::runtime::Runtime,
9191
{
9292
unimplemented!("System::with_tokio_rt is not implemented for io-uring feature yet")
9393
}

justfile

+4
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,10 @@ all_crate_features := if os() == "linux" {
2727
"--features='" + non_linux_all_features_list + "'"
2828
}
2929

30+
# Run Clippy over workspace.
31+
clippy toolchain="":
32+
cargo {{ toolchain }} clippy --workspace --all-targets {{ all_crate_features }}
33+
3034
# Test workspace code.
3135
[macos, windows]
3236
test toolchain="":

0 commit comments

Comments
 (0)