diff options
author | David Tolnay <dtolnay@gmail.com> | 2024-01-11 20:34:05 -0800 |
---|---|---|
committer | David Tolnay <dtolnay@gmail.com> | 2024-01-11 20:34:11 -0800 |
commit | 4a46306996d413e1fa880ef82d80c3ac75c2951e (patch) | |
tree | 781d84358c762d4758e9324b88746ce8d535d0d6 | |
parent | 5ceca34a2804552c93c5d7779635bc25af232052 (diff) | |
download | cxx-4a46306996d413e1fa880ef82d80c3ac75c2951e.tar.gz |
Resolve thread_local_initializer_can_be_made_const clippy lint
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)]`
-rw-r--r-- | tests/test.rs | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/tests/test.rs b/tests/test.rs index 6ef9a829..1611d971 100644 --- a/tests/test.rs +++ b/tests/test.rs @@ -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] |