mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2026-08-05 02:19:16 +00:00
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<Option<File>> = 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 <rbradford@rivosinc.com>
This commit is contained in:
@@ -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<Option<File>> = RefCell::new(None);
|
||||
static TX: RefCell<Option<File>> = const { RefCell::new(None) };
|
||||
}
|
||||
|
||||
fn with_tx<R, F: FnOnce(&File) -> R>(f: F) -> R {
|
||||
|
||||
Reference in New Issue
Block a user