[bindings] Drop useless `#[no_mangle]` from `pub type` definitions
[rust-lightning] / c-bindings-gen / src / types.rs
index 4e84f1430648bbc6e44f9b1cc33d56b2cf1c3bad..e3ae3bdef4f9012fd2b7014466f419b7080c8e19 100644 (file)
@@ -798,8 +798,8 @@ impl<'a, 'c: 'a> TypeResolver<'a, 'c> {
                match full_path {
                        "Result" if !is_ref => {
                                Some(("match ",
-                                               vec![(".result_ok { true => Ok(".to_string(), format!("(*unsafe {{ Box::from_raw({}.contents.result.take_ptr()) }})", var_name)),
-                                                    ("), false => Err(".to_string(), format!("(*unsafe {{ Box::from_raw({}.contents.err.take_ptr()) }})", var_name))],
+                                               vec![(".result_ok { true => Ok(".to_string(), format!("(*unsafe {{ Box::from_raw(<*mut _>::take_ptr(&mut {}.contents.result)) }})", var_name)),
+                                                    ("), false => Err(".to_string(), format!("(*unsafe {{ Box::from_raw(<*mut _>::take_ptr(&mut {}.contents.err)) }})", var_name))],
                                                ")}"))
                        },
                        "Vec"|"Slice" if !is_ref => {
@@ -1855,7 +1855,7 @@ impl<'a, 'c: 'a> TypeResolver<'a, 'c> {
                        self.crate_types.templates_defined.insert(mangled_container.clone(), true);
                        let mut created_container: Vec<u8> = Vec::new();
 
-                       write!(&mut created_container, "#[no_mangle]\npub type {} = ", mangled_container).unwrap();
+                       write!(&mut created_container, "pub type {} = ", mangled_container).unwrap();
                        write!(&mut created_container, "{}::C{}Templ<", Self::container_templ_path(), container_type).unwrap();
                        self.write_template_generics(&mut created_container, &mut args.iter().map(|t| *t), generics, is_ref, true);
                        writeln!(&mut created_container, ">;").unwrap();