Skip to content

Commit 30153f7

Browse files
committed
Merge branch 'master' of https://github.com/godot-rust/gdextension into feature/godot-compat
2 parents 4e1c6d9 + 3491d7b commit 30153f7

File tree

17 files changed

+503
-59
lines changed

17 files changed

+503
-59
lines changed

godot-core/src/builtin/macros.rs

+9-13
Original file line numberDiff line numberDiff line change
@@ -68,10 +68,10 @@ macro_rules! impl_builtin_traits_inner {
6868
impl Eq for $Type {}
6969
};
7070

71-
( PartialOrd for $Type:ty => $gd_method:ident ) => {
72-
impl PartialOrd for $Type {
71+
( Ord for $Type:ty => $gd_method:ident ) => {
72+
impl Ord for $Type {
7373
#[inline]
74-
fn partial_cmp(&self, other: &Self) -> Option<std::cmp::Ordering> {
74+
fn cmp(&self, other: &Self) -> std::cmp::Ordering {
7575
let op_less = |lhs, rhs| unsafe {
7676
let mut result = false;
7777
::godot_ffi::builtin_call! {
@@ -81,22 +81,18 @@ macro_rules! impl_builtin_traits_inner {
8181
};
8282

8383
if op_less(self.sys(), other.sys()) {
84-
Some(std::cmp::Ordering::Less)
84+
std::cmp::Ordering::Less
8585
} else if op_less(other.sys(), self.sys()) {
86-
Some(std::cmp::Ordering::Greater)
86+
std::cmp::Ordering::Greater
8787
} else {
88-
Some(std::cmp::Ordering::Equal)
88+
std::cmp::Ordering::Equal
8989
}
9090
}
9191
}
92-
};
93-
94-
( Ord for $Type:ty => $gd_method:ident ) => {
95-
impl_builtin_traits_inner!(PartialOrd for $Type => $gd_method);
96-
impl Ord for $Type {
92+
impl PartialOrd for $Type {
9793
#[inline]
98-
fn cmp(&self, other: &Self) -> std::cmp::Ordering {
99-
PartialOrd::partial_cmp(self, other).expect("PartialOrd::partial_cmp")
94+
fn partial_cmp(&self, other: &Self) -> Option<std::cmp::Ordering> {
95+
Some(self.cmp(other))
10096
}
10197
}
10298
};

godot-core/src/init/mod.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -102,8 +102,8 @@ fn gdext_on_level_init(level: InitLevel) {
102102
}
103103

104104
/// Tasks needed to be done by gdext internally upon unloading an initialization level. Called after user code.
105-
fn gdext_on_level_deinit(_level: InitLevel) {
106-
// No logic at the moment.
105+
fn gdext_on_level_deinit(level: InitLevel) {
106+
crate::unregister_classes(level);
107107
}
108108

109109
// ----------------------------------------------------------------------------------------------------------------------------------------------

0 commit comments

Comments
 (0)