Skip to content

Commit

Permalink
Fix clippy::thread_local_initializer_can_be_made_const
Browse files Browse the repository at this point in the history
warning: initializer for `thread_local` value can be made `const`
  --> gc/src/gc.rs:29:52
   |
29 | thread_local!(pub static GC_DROPPING: Cell<bool> = 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 <[email protected]>
  • Loading branch information
andersk committed Jul 17, 2024
1 parent d84eb95 commit 124f89e
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion gc/src/gc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<T>` pointer will trigger a panic.
thread_local!(pub static GC_DROPPING: Cell<bool> = Cell::new(false));
thread_local!(pub static GC_DROPPING: Cell<bool> = const { Cell::new(false) });
struct DropGuard;
impl DropGuard {
fn new() -> DropGuard {
Expand Down

0 comments on commit 124f89e

Please sign in to comment.