Skip to content
This repository was archived by the owner on Jun 8, 2021. It is now read-only.

Ignore false clippy warning cast_ptr_alignment #334

Merged
merged 1 commit into from
May 9, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions src/object.rs
Original file line number Diff line number Diff line change
Expand Up @@ -323,6 +323,7 @@ macro_rules! glib_object_wrapper {
#[doc(hidden)]
impl $crate::translate::FromGlibPtrNone<*mut $ffi_name> for $name {
#[inline]
#[cfg_attr(feature = "cargo-clippy", allow(cast_ptr_alignment))]
unsafe fn from_glib_none(ptr: *mut $ffi_name) -> Self {
debug_assert!($crate::types::instance_of::<Self>(ptr as *const _));
$name($crate::translate::from_glib_none(ptr as *mut _), ::std::marker::PhantomData)
Expand All @@ -332,6 +333,7 @@ macro_rules! glib_object_wrapper {
#[doc(hidden)]
impl $crate::translate::FromGlibPtrNone<*const $ffi_name> for $name {
#[inline]
#[cfg_attr(feature = "cargo-clippy", allow(cast_ptr_alignment))]
unsafe fn from_glib_none(ptr: *const $ffi_name) -> Self {
debug_assert!($crate::types::instance_of::<Self>(ptr as *const _));
$name($crate::translate::from_glib_none(ptr as *mut _), ::std::marker::PhantomData)
Expand All @@ -341,6 +343,7 @@ macro_rules! glib_object_wrapper {
#[doc(hidden)]
impl $crate::translate::FromGlibPtrFull<*mut $ffi_name> for $name {
#[inline]
#[cfg_attr(feature = "cargo-clippy", allow(cast_ptr_alignment))]
unsafe fn from_glib_full(ptr: *mut $ffi_name) -> Self {
debug_assert!($crate::types::instance_of::<Self>(ptr as *const _));
$name($crate::translate::from_glib_full(ptr as *mut _), ::std::marker::PhantomData)
Expand All @@ -350,6 +353,7 @@ macro_rules! glib_object_wrapper {
#[doc(hidden)]
impl $crate::translate::FromGlibPtrBorrow<*mut $ffi_name> for $name {
#[inline]
#[cfg_attr(feature = "cargo-clippy", allow(cast_ptr_alignment))]
unsafe fn from_glib_borrow(ptr: *mut $ffi_name) -> Self {
debug_assert!($crate::types::instance_of::<Self>(ptr as *const _));
$name($crate::translate::from_glib_borrow(ptr as *mut _),
Expand Down Expand Up @@ -464,13 +468,15 @@ macro_rules! glib_object_wrapper {

#[doc(hidden)]
impl $crate::value::SetValue for $name {
#[cfg_attr(feature = "cargo-clippy", allow(cast_ptr_alignment))]
unsafe fn set_value(value: &mut $crate::Value, this: &Self) {
gobject_ffi::g_value_set_object(value.to_glib_none_mut().0, $crate::translate::ToGlibPtr::<*mut $ffi_name>::to_glib_none(this).0 as *mut gobject_ffi::GObject)
}
}

#[doc(hidden)]
impl $crate::value::SetValueOptional for $name {
#[cfg_attr(feature = "cargo-clippy", allow(cast_ptr_alignment))]
unsafe fn set_value_optional(value: &mut $crate::Value, this: Option<&Self>) {
gobject_ffi::g_value_set_object(value.to_glib_none_mut().0, $crate::translate::ToGlibPtr::<*mut $ffi_name>::to_glib_none(&this).0 as *mut gobject_ffi::GObject)
}
Expand Down