From 124f89e0a9ab90a0c4b4652fe092db45a740d52a Mon Sep 17 00:00:00 2001 From: Anders Kaseorg Date: Wed, 17 Jul 2024 11:37:11 -0700 Subject: [PATCH] Fix clippy::thread_local_initializer_can_be_made_const warning: initializer for `thread_local` value can be made `const` --> gc/src/gc.rs:29:52 | 29 | thread_local!(pub static GC_DROPPING: Cell = Cell::new(false)); | ^^^^^^^^^^^^^^^^ help: replace with: `const { Cell::new(false) }` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#thread_local_initializer_can_be_made_const = note: `#[warn(clippy::thread_local_initializer_can_be_made_const)]` on by default Signed-off-by: Anders Kaseorg --- gc/src/gc.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gc/src/gc.rs b/gc/src/gc.rs index 9526c28..3e1f8f9 100644 --- a/gc/src/gc.rs +++ b/gc/src/gc.rs @@ -26,7 +26,7 @@ impl Drop for GcState { // Whether or not the thread is currently in the sweep phase of garbage collection. // During this phase, attempts to dereference a `Gc` pointer will trigger a panic. -thread_local!(pub static GC_DROPPING: Cell = Cell::new(false)); +thread_local!(pub static GC_DROPPING: Cell = const { Cell::new(false) }); struct DropGuard; impl DropGuard { fn new() -> DropGuard {