From cbdea7c9c78ea8423d239b0ede6f90f3775b59c7 Mon Sep 17 00:00:00 2001 From: Tobias Hunger Date: Thu, 5 Aug 2021 19:30:07 +0200 Subject: [PATCH] Janitor: Fix clippy::missing_safety_doc --- sixtyfps_runtime/corelib/items.rs | 6 ++++++ sixtyfps_runtime/corelib/rtti.rs | 3 ++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/sixtyfps_runtime/corelib/items.rs b/sixtyfps_runtime/corelib/items.rs index 3c0f04f25..10d9e57ad 100644 --- a/sixtyfps_runtime/corelib/items.rs +++ b/sixtyfps_runtime/corelib/items.rs @@ -1022,10 +1022,16 @@ impl core::ops::Deref for FlickableDataBox { } } +/// # Safety +/// This must be called using a non-null pointer pointing to a chunk of memory big enough to +/// hold a FlickableDataBox #[no_mangle] pub unsafe extern "C" fn sixtyfps_flickable_data_init(data: *mut FlickableDataBox) { std::ptr::write(data, FlickableDataBox::default()); } + +/// # Safety +/// This must be called using a non-null pointer pointing to an initialized FlickableDataBox #[no_mangle] pub unsafe extern "C" fn sixtyfps_flickable_data_free(data: *mut FlickableDataBox) { std::ptr::drop_in_place(data); diff --git a/sixtyfps_runtime/corelib/rtti.rs b/sixtyfps_runtime/corelib/rtti.rs index 16eb7608e..69c633615 100644 --- a/sixtyfps_runtime/corelib/rtti.rs +++ b/sixtyfps_runtime/corelib/rtti.rs @@ -99,7 +99,8 @@ pub trait PropertyInfo { /// Calls Property::link_two_ways with the property represented here and the property pointer /// - /// Safety: the property2 must be a pinned pointer to a Property of the same type + /// # Safety + /// the property2 must be a pinned pointer to a Property of the same type #[allow(unsafe_code)] unsafe fn link_two_ways(&self, item: Pin<&Item>, property2: *const ()); }