Skip to content

Commit 64468b2

Browse files
ci fixes
1 parent c92409e commit 64468b2

File tree

3 files changed

+16
-10
lines changed

3 files changed

+16
-10
lines changed

godot-macros/src/derive_export.rs

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,7 @@ pub fn transform(decl: Declaration) -> ParseResult<TokenStream2> {
2525
_ => unreachable!(),
2626
};
2727

28-
let hint_string;
29-
if enum_.variants.is_empty() {
28+
let hint_string = if enum_.variants.is_empty() {
3029
return bail!(
3130
enum_.name,
3231
"In order to derive Export, enums must have at least one variant"
@@ -43,7 +42,10 @@ pub fn transform(decl: Declaration) -> ParseResult<TokenStream2> {
4342
"Property can only be derived on enums with explicit discriminants in all their variants"
4443
);
4544
};
46-
let v_disc_trimmed = v_disc.to_string().trim_matches(['(', ')'].as_slice()).to_string();
45+
let v_disc_trimmed = v_disc
46+
.to_string()
47+
.trim_matches(['(', ')'].as_slice())
48+
.to_string();
4749

4850
hint_string_segments.push(format!("{v_name}:{v_disc_trimmed}"));
4951

@@ -57,8 +59,8 @@ pub fn transform(decl: Declaration) -> ParseResult<TokenStream2> {
5759
}
5860
};
5961
}
60-
hint_string = hint_string_segments.join(",");
61-
}
62+
hint_string_segments.join(",")
63+
};
6264

6365
let out = quote! {
6466
#[allow(unused_parens)]

godot-macros/src/lib.rs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -470,7 +470,8 @@ pub fn derive_from_variant(input: TokenStream) -> TokenStream {
470470
/// ```no_run
471471
/// # use godot::prelude::*;
472472
/// #[repr(i32)]
473-
/// #[derive(Debug, Property)]
473+
/// #[derive(Property)]
474+
/// # #[derive(PartialEq, Eq, Debug)]
474475
/// enum TestEnum {
475476
/// A = 0,
476477
/// B = 1,
@@ -482,11 +483,14 @@ pub fn derive_from_variant(input: TokenStream) -> TokenStream {
482483
/// foo: TestEnum
483484
/// }
484485
///
486+
/// # #[godot_api]
487+
/// # impl TestClass {}
488+
///
485489
/// # fn main() {
486-
/// let mut class = TestClass {foo: TestEnum::B}.get_foo();
490+
/// let mut class = TestClass {foo: TestEnum::B};
487491
/// assert_eq!(class.get_foo(), TestEnum::B as i32);
488-
/// class.set_foo(TestEnum::A);
489-
/// assert_eq!(class.foo, TestEnum::A as i32);
492+
/// class.set_foo(TestEnum::A as i32);
493+
/// assert_eq!(class.foo, TestEnum::A);
490494
/// # }
491495
/// ```
492496
#[proc_macro_derive(Property)]

itest/rust/src/property_test.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -321,7 +321,7 @@ fn derive_property() {
321321
}
322322

323323
#[derive(GodotClass)]
324-
#[class( base = Object)]
324+
#[class(base = Object)]
325325
pub struct DeriveExport {
326326
#[export]
327327
pub foo: TestEnum,

0 commit comments

Comments
 (0)