From cdf2fe3504bc809eac4f65cbf24b4fe545d54c65 Mon Sep 17 00:00:00 2001 From: Jose Celano Date: Mon, 23 Sep 2024 15:56:13 +0100 Subject: [PATCH] fix: chedck error Mutable static variables are discouraged. I guess we should move them to the proxy service. We wanted to avoid generating the error images every time we need them becuase it's costly. I would created them when the proxy service is instanciated or maybe we can create a new service with static content for the proxy. --- src/ui/proxy.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/ui/proxy.rs b/src/ui/proxy.rs index 78dd2fc2..a886e6de 100644 --- a/src/ui/proxy.rs +++ b/src/ui/proxy.rs @@ -32,7 +32,11 @@ pub fn load_error_images() { }); } +#[allow(static_mut_refs)] pub fn map_error_to_image(error: &Error) -> Bytes { + // todo: remove "#[allow(static_mut_refs)]" attribute by assigning a owner + // to the static mutable variables ERROR_IMAGE_*. Maybe the proxy service. + load_error_images(); unsafe { match error {