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

Commit 5900cec

Browse files
committed
Get rid of some unneeded transmutes
1 parent 5651761 commit 5900cec

File tree

1 file changed

+3
-12
lines changed

1 file changed

+3
-12
lines changed

src/object.rs

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -679,10 +679,7 @@ macro_rules! glib_object_wrapper {
679679
#[doc(hidden)]
680680
impl AsRef<$super_name> for $name {
681681
fn as_ref(&self) -> &$super_name {
682-
debug_assert!($crate::object::ObjectExt::is::<$super_name>(self));
683-
unsafe {
684-
::std::mem::transmute(self)
685-
}
682+
$crate::object::Cast::upcast_ref(self)
686683
}
687684
}
688685
};
@@ -782,10 +779,7 @@ macro_rules! glib_object_wrapper {
782779
#[doc(hidden)]
783780
impl AsRef<$crate::object::Object> for $name {
784781
fn as_ref(&self) -> &$crate::object::Object {
785-
debug_assert!($crate::object::ObjectExt::is::<$crate::object::Object>(self));
786-
unsafe {
787-
::std::mem::transmute(self)
788-
}
782+
$crate::object::Cast::upcast_ref(self)
789783
}
790784
}
791785

@@ -801,10 +795,7 @@ macro_rules! glib_object_wrapper {
801795
#[doc(hidden)]
802796
impl AsRef<$crate::object::Object> for $name {
803797
fn as_ref(&self) -> &$crate::object::Object {
804-
debug_assert!($crate::object::ObjectExt::is::<$crate::object::Object>(self));
805-
unsafe {
806-
::std::mem::transmute(self)
807-
}
798+
$crate::object::Cast::upcast_ref(self)
808799
}
809800
}
810801

0 commit comments

Comments
 (0)