Skip to content

Commit

Permalink
remove unsafe from tests in core
Browse files Browse the repository at this point in the history
  • Loading branch information
jkelleyrtp committed Feb 23, 2024
1 parent 8219b11 commit e0b0afc
Showing 1 changed file with 5 additions and 9 deletions.
14 changes: 5 additions & 9 deletions packages/core/tests/fuzzing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@

use dioxus::prelude::*;
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> {
let namespace = rand::random::<u8>() % 2;
Expand Down Expand Up @@ -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 {
Box::leak(
format!(
"{}{}",
concat!(file!(), ":", line!(), ":", column!(), ":"),
{
unsafe {
let old = TEMPLATE_COUNT;
TEMPLATE_COUNT += 1;
old
}
}
TEMPLATE_COUNT.fetch_add(1, Ordering::Relaxed)
)
.into_boxed_str(),
)
Expand Down

0 comments on commit e0b0afc

Please sign in to comment.