From 472736a292077f47dabc272a594c588a46c4cfdc Mon Sep 17 00:00:00 2001 From: iris <2+iris@noreply.localhost> Date: Sun, 13 Sep 2026 01:04:10 -0400 Subject: [PATCH] Keep the unsafe helper change minimal --- core/src/util/mod.rs | 2 +- core/src/util/trust.rs | 17 +++-------------- 2 files changed, 4 insertions(+), 15 deletions(-) diff --git a/core/src/util/mod.rs b/core/src/util/mod.rs index 69c3331..34a287f 100644 --- a/core/src/util/mod.rs +++ b/core/src/util/mod.rs @@ -16,7 +16,7 @@ pub use id::*; pub use math::*; pub use refcount::*; pub use slot::*; -pub use trust::*; +pub(crate) use trust::*; pub use typemap::*; pub use vec2::*; diff --git a/core/src/util/trust.rs b/core/src/util/trust.rs index fc48c17..c5163e7 100644 --- a/core/src/util/trust.rs +++ b/core/src/util/trust.rs @@ -1,25 +1,14 @@ -/// Extends a shared reference's lifetime. -/// -/// # Safety -/// The pointee must remain alive and shared-borrowed for all of `'a`. +#[allow(clippy::missing_safety_doc)] pub(crate) unsafe fn forget_ref<'a, T>(x: &T) -> &'a T { unsafe { std::mem::transmute::<&T, &T>(x) } } -/// Extends an exclusive reference's lifetime. -/// -/// # Safety -/// The pointee must remain alive and exclusively borrowed for all of `'a`. +#[allow(clippy::missing_safety_doc)] pub(crate) unsafe fn forget_mut<'a, T>(x: &mut T) -> &'a mut T { unsafe { std::mem::transmute::<&mut T, &mut T>(x) } } -/// Converts a shared reference into an exclusive reference. -/// -/// # Safety -/// The caller must have exclusive access to the pointee for the returned -/// reference's lifetime. -#[allow(clippy::mut_from_ref)] +#[allow(clippy::mut_from_ref, clippy::missing_safety_doc)] pub(crate) unsafe fn to_mut(x: &T) -> &mut T { #[allow(mutable_transmutes)] unsafe {