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

Commit 57df6cc

Browse files
Merge pull request #334 from EPashkin/clippy_fix
Ignore false clippy warning cast_ptr_alignment
2 parents 4344176 + cb9ba5b commit 57df6cc

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/object.rs

+6
Original file line numberDiff line numberDiff line change
@@ -323,6 +323,7 @@ macro_rules! glib_object_wrapper {
323323
#[doc(hidden)]
324324
impl $crate::translate::FromGlibPtrNone<*mut $ffi_name> for $name {
325325
#[inline]
326+
#[cfg_attr(feature = "cargo-clippy", allow(cast_ptr_alignment))]
326327
unsafe fn from_glib_none(ptr: *mut $ffi_name) -> Self {
327328
debug_assert!($crate::types::instance_of::<Self>(ptr as *const _));
328329
$name($crate::translate::from_glib_none(ptr as *mut _), ::std::marker::PhantomData)
@@ -332,6 +333,7 @@ macro_rules! glib_object_wrapper {
332333
#[doc(hidden)]
333334
impl $crate::translate::FromGlibPtrNone<*const $ffi_name> for $name {
334335
#[inline]
336+
#[cfg_attr(feature = "cargo-clippy", allow(cast_ptr_alignment))]
335337
unsafe fn from_glib_none(ptr: *const $ffi_name) -> Self {
336338
debug_assert!($crate::types::instance_of::<Self>(ptr as *const _));
337339
$name($crate::translate::from_glib_none(ptr as *mut _), ::std::marker::PhantomData)
@@ -341,6 +343,7 @@ macro_rules! glib_object_wrapper {
341343
#[doc(hidden)]
342344
impl $crate::translate::FromGlibPtrFull<*mut $ffi_name> for $name {
343345
#[inline]
346+
#[cfg_attr(feature = "cargo-clippy", allow(cast_ptr_alignment))]
344347
unsafe fn from_glib_full(ptr: *mut $ffi_name) -> Self {
345348
debug_assert!($crate::types::instance_of::<Self>(ptr as *const _));
346349
$name($crate::translate::from_glib_full(ptr as *mut _), ::std::marker::PhantomData)
@@ -350,6 +353,7 @@ macro_rules! glib_object_wrapper {
350353
#[doc(hidden)]
351354
impl $crate::translate::FromGlibPtrBorrow<*mut $ffi_name> for $name {
352355
#[inline]
356+
#[cfg_attr(feature = "cargo-clippy", allow(cast_ptr_alignment))]
353357
unsafe fn from_glib_borrow(ptr: *mut $ffi_name) -> Self {
354358
debug_assert!($crate::types::instance_of::<Self>(ptr as *const _));
355359
$name($crate::translate::from_glib_borrow(ptr as *mut _),
@@ -464,13 +468,15 @@ macro_rules! glib_object_wrapper {
464468

465469
#[doc(hidden)]
466470
impl $crate::value::SetValue for $name {
471+
#[cfg_attr(feature = "cargo-clippy", allow(cast_ptr_alignment))]
467472
unsafe fn set_value(value: &mut $crate::Value, this: &Self) {
468473
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)
469474
}
470475
}
471476

472477
#[doc(hidden)]
473478
impl $crate::value::SetValueOptional for $name {
479+
#[cfg_attr(feature = "cargo-clippy", allow(cast_ptr_alignment))]
474480
unsafe fn set_value_optional(value: &mut $crate::Value, this: Option<&Self>) {
475481
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)
476482
}

0 commit comments

Comments
 (0)