Skip to content

Commit 54352b8

Browse files
author
toasteater
committed
Use UFCS for to_variant calls when deriving the trait
When using the macro to derive `OwnedToVariant` without importing the prelude, the internal calls to `to_variant` will no longer fail to compile.
1 parent e2fc055 commit 54352b8

File tree

1 file changed

+4
-2
lines changed
  • gdnative-derive/src/variant

1 file changed

+4
-2
lines changed

gdnative-derive/src/variant/to.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,12 @@ pub(crate) fn expand_to_variant(
4848
let tokens = quote! {
4949
#ident::#var_ident #destructure_pattern => {
5050
let __dict = ::gdnative::core_types::Dictionary::new();
51-
let __key = ::gdnative::core_types::GodotString::from(#var_ident_string_literal).to_variant();
51+
let __key = ::gdnative::core_types::ToVariant::to_variant(
52+
&::gdnative::core_types::GodotString::from(#var_ident_string_literal)
53+
);
5254
let __value = #to_variant;
5355
__dict.insert(&__key, &__value);
54-
__dict.into_shared().to_variant()
56+
::gdnative::core_types::ToVariant::to_variant(&__dict.into_shared())
5557
}
5658
};
5759
Ok(tokens)

0 commit comments

Comments
 (0)