From 9dfc39d336c2cc921649e1faa2b60fd2820cd6b6 Mon Sep 17 00:00:00 2001 From: Rob Bradford Date: Tue, 6 Feb 2024 21:02:54 +0000 Subject: [PATCH] vmm: Make thread local initialiser constant Beta clippy fix: warning: initializer for `thread_local` value can be made `const` --> vmm/src/sigwinch_listener.rs:27:40 | 27 | static TX: RefCell> = RefCell::new(None); | ^^^^^^^^^^^^^^^^^^ help: replace with: `const { RefCell::new(None) }` | = 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: Rob Bradford --- vmm/src/sigwinch_listener.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vmm/src/sigwinch_listener.rs b/vmm/src/sigwinch_listener.rs index c4ef3119b..0aad87853 100644 --- a/vmm/src/sigwinch_listener.rs +++ b/vmm/src/sigwinch_listener.rs @@ -24,7 +24,7 @@ use vmm_sys_util::signal::register_signal_handler; thread_local! { // The tty file descriptor is stored in a global variable so it // can be accessed by a signal handler. - static TX: RefCell> = RefCell::new(None); + static TX: RefCell> = const { RefCell::new(None) }; } fn with_tx R>(f: F) -> R {