Skip to content

Commit 60c7c69

Browse files
authored
Merge pull request #18 from Pi-Cla/clippy
Update clippy allows and use const in thread local
2 parents cd4c192 + 32e8ff9 commit 60c7c69

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/executor.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ use std::future::Future;
55
pub(crate) static GLOBAL_EXECUTOR: Executor<'_> = Executor::new();
66

77
thread_local! {
8-
pub(crate) static LOCAL_EXECUTOR: LocalExecutor<'static> = LocalExecutor::new();
8+
pub(crate) static LOCAL_EXECUTOR: LocalExecutor<'static> = const { LocalExecutor::new() };
99
}
1010

1111
/// Runs the global and the local executor on the current thread

src/threading.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ static GLOBAL_EXECUTOR_EXPECTED_THREADS_NUMBER: Mutex<usize> = Mutex::new(0);
1313
thread_local! {
1414
// Used to shutdown a thread when we receive a message from the Sender.
1515
// We send an ack using to the Receiver once we're finished shutting down.
16-
static THREAD_SHUTDOWN: OnceCell<(Sender<()>, Receiver<()>)> = OnceCell::new();
16+
static THREAD_SHUTDOWN: OnceCell<(Sender<()>, Receiver<()>)> = const { OnceCell::new() };
1717
}
1818

1919
/// Spawn more executor threads, up to configured max value.
@@ -84,7 +84,7 @@ fn thread_main_loop() {
8484

8585
// Main loop
8686
loop {
87-
#[allow(clippy::blocks_in_if_conditions)]
87+
#[allow(clippy::blocks_in_conditions)]
8888
if std::panic::catch_unwind(|| {
8989
crate::executor::LOCAL_EXECUTOR.with(|executor| {
9090
let local = executor.run(async {
@@ -111,7 +111,7 @@ fn thread_main_loop() {
111111

112112
fn wait_for_local_executor_completion() {
113113
loop {
114-
#[allow(clippy::blocks_in_if_conditions)]
114+
#[allow(clippy::blocks_in_conditions)]
115115
if std::panic::catch_unwind(|| {
116116
crate::executor::LOCAL_EXECUTOR.with(|executor| {
117117
crate::reactor::block_on(async {

0 commit comments

Comments
 (0)