Skip to content

Commit

Permalink
Resolve thread_local_initializer_can_be_made_const clippy lint
Browse files Browse the repository at this point in the history
    warning: initializer for `thread_local` value can be made `const`
      --> tests/test.rs:20:34
       |
    20 |     static CORRECT: 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: `-W clippy::thread-local-initializer-can-be-made-const` implied by `-W clippy::all`
       = help: to override `-W clippy::all` add `#[allow(clippy::thread_local_initializer_can_be_made_const)]`
  • Loading branch information
dtolnay committed Jan 12, 2024
1 parent 5ceca34 commit 4a46306
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion tests/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ use std::cell::Cell;
use std::ffi::CStr;

thread_local! {
static CORRECT: Cell<bool> = Cell::new(false);
static CORRECT: Cell<bool> = const { Cell::new(false) };
}

#[no_mangle]
Expand Down

0 comments on commit 4a46306

Please sign in to comment.