Skip to content

Commit 4e812f9

Browse files
committed
Change rust edition to 2024 and format code
1 parent 702a4ef commit 4e812f9

File tree

9 files changed

+32
-21
lines changed

9 files changed

+32
-21
lines changed

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
name = "crossfire"
33
version = "1.0.3"
44
authors = ["plan <frostyplanet@gmail.com>"]
5-
edition = "2018"
5+
edition = "2024"
66
license = "Apache-2.0"
77
homepage = "https://github.com/frostyplanet/crossfire-rs"
88
readme = "README.md"

rustfmt.toml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
#unstable_features = true
2-
edition = "2018"
1+
edition = "2024"
32
fn_params_layout = "Compressed"
43
newline_style = "Unix"
54
use_small_heuristics = "Max"

src/channel/locked_waker.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use std::sync::{
2-
atomic::{AtomicBool, Ordering},
32
Arc, Weak,
3+
atomic::{AtomicBool, Ordering},
44
};
55
use std::task::*;
66

src/mpmc/bounded.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ use super::tx::*;
33
use crate::channel::*;
44
use crossbeam::queue::SegQueue;
55
use std::sync::{
6-
atomic::{AtomicBool, AtomicU64, AtomicUsize, Ordering},
76
Arc,
7+
atomic::{AtomicBool, AtomicU64, AtomicUsize, Ordering},
88
};
99
use std::task::*;
1010

@@ -309,8 +309,11 @@ mod tests {
309309
}
310310
let end = Instant::now();
311311

312-
println!("{} message, single sender thread single receiver thread use std::sync::sync_channel, cost time:{} s",
313-
total_message, (total_message as f64) / end.duration_since(start).as_secs_f64());
312+
println!(
313+
"{} message, single sender thread single receiver thread use std::sync::sync_channel, cost time:{} s",
314+
total_message,
315+
(total_message as f64) / end.duration_since(start).as_secs_f64()
316+
);
314317
}
315318

316319
#[test]

src/mpmc/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@ pub use tx::*;
33
mod rx;
44
pub use rx::*;
55
mod bounded;
6+
pub use bounded::{SharedFutureBoth, SharedSenderBRecvF, SharedSenderFRecvB};
67
pub use bounded::{
78
bounded_future_both, bounded_tx_blocking_rx_future, bounded_tx_future_rx_blocking,
89
};
9-
pub use bounded::{SharedFutureBoth, SharedSenderBRecvF, SharedSenderFRecvB};
1010
mod unbounded;
11-
pub use unbounded::{unbounded_future, RxUnbounded, TxUnbounded, UnboundedSharedFuture};
11+
pub use unbounded::{RxUnbounded, TxUnbounded, UnboundedSharedFuture, unbounded_future};
1212

1313
pub use crate::channel::{AsyncRx, LockedWaker};

src/mpmc/unbounded.rs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ use super::tx::*;
33
use crate::channel::*;
44
use crossbeam::queue::SegQueue;
55
use std::sync::{
6-
atomic::{AtomicBool, AtomicU64, AtomicUsize, Ordering},
76
Arc,
7+
atomic::{AtomicBool, AtomicU64, AtomicUsize, Ordering},
88
};
99
use std::task::*;
1010

@@ -125,8 +125,11 @@ mod tests {
125125
}
126126
let end = Instant::now();
127127

128-
println!("{} message, single sender thread single receiver thread use std::sync::sync_channel, cost time:{} s",
129-
total_message, (total_message as f64) / end.duration_since(start).as_secs_f64());
128+
println!(
129+
"{} message, single sender thread single receiver thread use std::sync::sync_channel, cost time:{} s",
130+
total_message,
131+
(total_message as f64) / end.duration_since(start).as_secs_f64()
132+
);
130133
}
131134

132135
#[test]
@@ -271,7 +274,7 @@ mod tests {
271274

272275
#[test]
273276
fn test_tx_unbounded_idle_select() {
274-
use futures::{pin_mut, select, FutureExt};
277+
use futures::{FutureExt, pin_mut, select};
275278
let rt = tokio::runtime::Builder::new_multi_thread()
276279
.worker_threads(2)
277280
.enable_all()

src/mpsc/bounded.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ use super::tx::*;
33
use crate::channel::*;
44
use crossbeam::queue::{ArrayQueue, SegQueue};
55
use std::sync::{
6-
atomic::{AtomicBool, AtomicU64, AtomicUsize, Ordering},
76
Arc,
7+
atomic::{AtomicBool, AtomicU64, AtomicUsize, Ordering},
88
};
99
use std::task::*;
1010

@@ -350,8 +350,11 @@ mod tests {
350350
}
351351
let end = Instant::now();
352352

353-
println!("{} message, single sender thread single receiver thread use std::sync::sync_channel, cost time:{} s",
354-
total_message, (total_message as f64) / end.duration_since(start).as_secs_f64());
353+
println!(
354+
"{} message, single sender thread single receiver thread use std::sync::sync_channel, cost time:{} s",
355+
total_message,
356+
(total_message as f64) / end.duration_since(start).as_secs_f64()
357+
);
355358
}
356359

357360
#[test]

src/mpsc/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@ pub use tx::*;
33
mod rx;
44
pub use rx::*;
55
mod bounded;
6+
pub use bounded::{SharedFutureBoth, SharedSenderBRecvF, SharedSenderFRecvB};
67
pub use bounded::{
78
bounded_future_both, bounded_tx_blocking_rx_future, bounded_tx_future_rx_blocking,
89
};
9-
pub use bounded::{SharedFutureBoth, SharedSenderBRecvF, SharedSenderFRecvB};
1010
mod unbounded;
11-
pub use unbounded::{unbounded_future, RxUnbounded, TxUnbounded, UnboundedSharedFuture};
11+
pub use unbounded::{RxUnbounded, TxUnbounded, UnboundedSharedFuture, unbounded_future};

src/mpsc/unbounded.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ use super::tx::*;
33
use crate::channel::*;
44
use crossbeam::queue::ArrayQueue;
55
use std::sync::{
6-
atomic::{AtomicUsize, Ordering},
76
Arc,
7+
atomic::{AtomicUsize, Ordering},
88
};
99
use std::task::*;
1010

@@ -100,8 +100,11 @@ mod tests {
100100
}
101101
let end = Instant::now();
102102

103-
println!("{} message, single sender thread single receiver thread use std::sync::sync_channel, cost time:{} s",
104-
total_message, (total_message as f64) / end.duration_since(start).as_secs_f64());
103+
println!(
104+
"{} message, single sender thread single receiver thread use std::sync::sync_channel, cost time:{} s",
105+
total_message,
106+
(total_message as f64) / end.duration_since(start).as_secs_f64()
107+
);
105108
}
106109

107110
#[test]

0 commit comments

Comments
 (0)