remove unsafe from tests in core

This commit is contained in:
Jonathan Kelley committed 2024-02-22 17:46:51 -08:00
1 parent 8219b117b0
commit e0b0afc0a9
1 file changed
+5 -9
+5 -9
View File
@@ -2,7 +2,9 @@
use dioxus::prelude::*; use dioxus::prelude::*;
use dioxus_core::{AttributeValue, DynamicNode, NoOpMutations, VComponent, VNode, *}; use dioxus_core::{AttributeValue, DynamicNode, NoOpMutations, VComponent, VNode, *};
use std::{cfg, collections::HashSet, default::Default}; use std::{
cfg, collections::HashSet, default::Default, sync::atomic::AtomicUsize, sync::atomic::Ordering,
};
fn random_ns() -> Option<&'static str> { fn random_ns() -> Option<&'static str> {
let namespace = rand::random::<u8>() % 2; let namespace = rand::random::<u8>() % 2;
@@ -220,20 +222,14 @@ fn create_random_dynamic_attr() -> Attribute {
) )
} }
static mut TEMPLATE_COUNT: usize = 0; static TEMPLATE_COUNT: AtomicUsize = AtomicUsize::new(0);
fn create_template_location() -> &'static str { fn create_template_location() -> &'static str {
Box::leak( Box::leak(
format!( format!(
"{}{}", "{}{}",
concat!(file!(), ":", line!(), ":", column!(), ":"), concat!(file!(), ":", line!(), ":", column!(), ":"),
{ TEMPLATE_COUNT.fetch_add(1, Ordering::Relaxed)
unsafe {
let old = TEMPLATE_COUNT;
TEMPLATE_COUNT += 1;
old
}
}
) )
.into_boxed_str(), .into_boxed_str(),
) )