From 80f1d5c1f84c4be1ec4bcbfc3ac39b515809f579 Mon Sep 17 00:00:00 2001 From: Bradlee Speice Date: Sat, 10 Nov 2018 22:01:41 -0500 Subject: [PATCH] Mark internal functions as not needing `unsafe` Even though they're not used by any `safe` code --- src/lib.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index 47d0ef0..44b2338 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -73,7 +73,7 @@ pub fn exit_protected() { static INTERNAL_ALLOCATION: RwLock = RwLock::new(usize::max_value()); -unsafe fn claim_internal_alloc() { +fn claim_internal_alloc() { loop { match INTERNAL_ALLOCATION.write() { ref mut lock if **lock == usize::max_value() => { @@ -85,14 +85,14 @@ unsafe fn claim_internal_alloc() { } } -unsafe fn release_internal_alloc() { +fn release_internal_alloc() { match INTERNAL_ALLOCATION.write() { ref mut lock if **lock == thread_id::get() => **lock = usize::max_value(), _ => panic!("Internal allocation tracking error"), } } -unsafe fn alloc_immediate() -> bool { +fn alloc_immediate() -> bool { thread::panicking() || *INTERNAL_ALLOCATION.read() == thread_id::get() }