Skip to content

Commit

Permalink
new clippy issues
Browse files Browse the repository at this point in the history
  • Loading branch information
kennykerr committed Sep 13, 2023
1 parent 97064e0 commit b79f6ac
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 2 deletions.
2 changes: 2 additions & 0 deletions crates/libs/core/src/array.rs
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,8 @@ impl<T: Type<T>> Array<T> {
#[doc(hidden)]
/// Get a mutable pointer to the array's length
///
/// # Safety
///
/// This function is safe but writing to the pointer is not. Calling this without
/// a subsequent call to `set_abi` is likely to either leak memory or cause UB
pub unsafe fn set_abi_len(&mut self) -> *mut u32 {
Expand Down
2 changes: 1 addition & 1 deletion crates/libs/core/src/com_interface.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ pub unsafe trait ComInterface: Interface + Clone {

/// Call `QueryInterface` on this interface
///
/// # SAFETY
/// # Safety
///
/// `interface` must be a non-null, valid pointer for writing an interface pointer
#[doc(hidden)]
Expand Down
3 changes: 2 additions & 1 deletion crates/libs/core/src/interface.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ pub unsafe trait Interface: Sized {

/// Cast this interface as a reference to the supplied interfaces `Vtable`
///
/// # SAFETY
/// # Safety
///
/// This is safe if `T` is an equivalent interface to `Self` or a super interface.
/// In other words, `T::Vtable` must be equivalent to the beginning of `Self::Vtable`.
Expand Down Expand Up @@ -65,6 +65,7 @@ pub unsafe trait Interface: Sized {
}
}

/// # Safety
#[doc(hidden)]
pub unsafe fn from_raw_borrowed<T: Interface>(raw: &*mut std::ffi::c_void) -> Option<&T> {
T::from_raw_borrowed(raw)
Expand Down
2 changes: 2 additions & 0 deletions crates/libs/core/src/strings/bstr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,13 @@ impl BSTR {
}
}

/// # Safety
#[doc(hidden)]
pub unsafe fn from_raw(raw: *const u16) -> Self {
Self(raw)
}

/// # Safety
#[doc(hidden)]
pub fn into_raw(self) -> *const u16 {
unsafe { std::mem::transmute(self) }
Expand Down
1 change: 1 addition & 0 deletions crates/libs/core/src/type.rs
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ primitives!(bool, i8, u8, i16, u16, i32, u32, i64, u64, f32, f64, usize, isize);
#[doc(hidden)]
pub type AbiType<T> = <T as Type<T>>::Abi;

/// # Safety
#[doc(hidden)]
pub unsafe fn from_abi<T: Type<T>>(abi: T::Abi) -> Result<T> {
T::from_abi(abi)
Expand Down

0 comments on commit b79f6ac

Please sign in to comment.