Skip to content

Commit

Permalink
+
Browse files Browse the repository at this point in the history
  • Loading branch information
Bromeon committed Sep 15, 2024
1 parent d5e3003 commit 8ccbde2
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 13 deletions.
4 changes: 2 additions & 2 deletions godot-codegen/src/generator/default_parameters.rs
Original file line number Diff line number Diff line change
Expand Up @@ -398,8 +398,8 @@ fn make_field_init(
match (conversion, expr) {
(Conv::ObjectArg, Some(expr)) => quote! { #name: #expr.consume_object() },
(Conv::ObjectArg, None) /*. */ => quote! { #name: #name.consume_object() },
(Conv::Reference, Some(expr)) => quote! { #name: & #expr },
(Conv::Reference, None) /*. */ => quote! { #name: & #name },
(Conv::Reference, Some(expr)) => quote! { #name: #expr },
(Conv::Reference, None) /*. */ => quote! { #name },
(Conv::None | Conv::ReferenceWithDefault, Some(expr)) => quote! { #name: #expr },
(Conv::None | Conv::ReferenceWithDefault, None) /*. */ => quote! { #name },
}
Expand Down
1 change: 1 addition & 0 deletions godot-core/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ compile_error!("Generating editor docs for Rust symbols requires at least Godot
#[allow(clippy::let_unit_value)] // let args = ();
#[allow(clippy::wrong_self_convention)] // to_string() is const
#[allow(clippy::upper_case_acronyms)] // TODO remove this line once we transform names
#[allow(clippy::needless_lifetimes)] // the following explicit lifetimes could be elided: 'a
#[allow(unreachable_code, clippy::unimplemented)] // TODO remove once #153 is implemented
mod gen {
include!(concat!(env!("OUT_DIR"), "/mod.rs"));
Expand Down
14 changes: 4 additions & 10 deletions godot-core/src/meta/godot_convert/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -95,18 +95,12 @@ pub trait FromGodot: Sized + GodotConvert {
}
}

// pub(crate) fn into_ffi<'v, T: ToGodot >(value: T) -> <T::ToVia<'v> as GodotType>::Ffi {
// let by_ref = value.to_godot();
// let ffi = by_ref.to_ffi();
//
// ffi
// }

// Note: removing the implicit lifetime (by taking value: T instead of &T) causes issues due to allegedly returning a lifetime
// to a local variable, even though the result Ffi is 'static by definition.
#[allow(clippy::needless_lifetimes)] // eliding causes error: missing generics for associated type `godot_convert::ToGodot::ToVia`
pub(crate) fn into_ffi<'v, T: ToGodot>(value: &'v T) -> <T::ToVia<'v> as GodotType>::Ffi {
let by_ref = value.to_godot();
let ffi = by_ref.to_ffi();

ffi
by_ref.to_ffi()
}

pub(crate) fn into_ffi_variant<T: ToGodot>(value: &T) -> Variant {
Expand Down
2 changes: 1 addition & 1 deletion itest/rust/src/builtin_tests/containers/array_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ fn array_from_packed_array() {
// This tests that the resulting array doesn't secretly have a runtime type assigned to it,
// which is not reflected in our static type. It would make sense if it did, but Godot decided
// otherwise: we get an untyped array.
array.push(&GString::from("hi").to_variant());
array.push(GString::from("hi").to_variant());
assert_eq!(array, varray![42, "hi"]);
}

Expand Down

0 comments on commit 8ccbde2

Please sign in to comment.