From e9429db50fa5a5f45c9ccc15ff296a2d0d62beff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BC=8A=E6=AC=A7?= Date: Fri, 29 Mar 2024 01:25:08 +0800 Subject: [PATCH] Clippy --- packages/yew-router/src/utils.rs | 2 +- packages/yew/src/renderer.rs | 2 +- packages/yew/src/virtual_dom/vlist.rs | 1 + 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/packages/yew-router/src/utils.rs b/packages/yew-router/src/utils.rs index 8b8a7797fd4..a1a1067eedb 100644 --- a/packages/yew-router/src/utils.rs +++ b/packages/yew-router/src/utils.rs @@ -8,7 +8,7 @@ pub(crate) fn strip_slash_suffix(path: &str) -> &str { static BASE_URL_LOADED: std::sync::Once = std::sync::Once::new(); thread_local! { - static BASE_URL: RefCell> = RefCell::new(None); + static BASE_URL: RefCell> = const { RefCell::new(None) }; } // This exists so we can cache the base url. It costs us a `to_string` call instead of a DOM API diff --git a/packages/yew/src/renderer.rs b/packages/yew/src/renderer.rs index 442268a281c..7c7e20e63c6 100644 --- a/packages/yew/src/renderer.rs +++ b/packages/yew/src/renderer.rs @@ -8,7 +8,7 @@ use crate::app_handle::AppHandle; use crate::html::BaseComponent; thread_local! { - static PANIC_HOOK_IS_SET: Cell = Cell::new(false); + static PANIC_HOOK_IS_SET: Cell = const { Cell::new(false) }; } /// Set a custom panic hook. diff --git a/packages/yew/src/virtual_dom/vlist.rs b/packages/yew/src/virtual_dom/vlist.rs index 1001444fe8b..a80f5f6b480 100644 --- a/packages/yew/src/virtual_dom/vlist.rs +++ b/packages/yew/src/virtual_dom/vlist.rs @@ -48,6 +48,7 @@ impl Deref for VList { // This is mutable because the Vec is not Sync static mut EMPTY: Vec = Vec::new(); // SAFETY: The EMPTY value is always read-only + #[allow(static_mut_refs)] unsafe { &EMPTY } } }