Call methods explicitly on traits to avoid to deref recursion
[ldk-c-bindings] / c-bindings-gen / src / types.rs
index 96a4135f9c1f3800a00a4eb7239d653a9cb95879..efd6b9afcb24e48bbfef296dcb5e01984816a6b4 100644 (file)
@@ -1922,7 +1922,7 @@ impl<'a, 'c: 'a> TypeResolver<'a, 'c> {
                                                DeclType::EnumIgnored|DeclType::StructImported if !is_ref =>
                                                        write!(w, "crate::{} {{ inner: ObjOps::heap_alloc(", decl_path).unwrap(),
                                                DeclType::Trait(_) if is_ref => write!(w, "").unwrap(),
-                                               DeclType::Trait(_) if !is_ref => {},
+                                               DeclType::Trait(_) if !is_ref => write!(w, "Into::into(").unwrap(),
                                                _ => panic!("{:?}", decl_path),
                                        }
                                });
@@ -1948,7 +1948,7 @@ impl<'a, 'c: 'a> TypeResolver<'a, 'c> {
                                                // for use when a Rust trait method returns an associated type.
                                                // Because all of our C traits implement From<RustTypesImplementingTraits>
                                                // we can just call .into() here and be done.
-                                               write!(w, ".into()").unwrap()
+                                               write!(w, ")").unwrap()
                                        },
                                        _ => unimplemented!(),
                                });