Drop `#[no_mangle]`/`extern` flag for internal-only method
[ldk-c-bindings] / c-bindings-gen / src / types.rs
index 9df1bd1c1ef309e13aef79f99072c3c265adf128..007a05b1fc8a4e4e97389cc6871a250248680f1a 100644 (file)
@@ -679,6 +679,8 @@ impl<'mod_lifetime, 'crate_lft: 'mod_lifetime> ImportResolver<'mod_lifetime, 'cr
                                Some(first_seg_str + &remaining)
                        } else if first_seg_str == "crate" {
                                Some(self.crate_name.to_owned() + &remaining)
+                       } else if self.library.modules.get(&format!("{}::{}", self.module_path, first_seg.ident)).is_some() {
+                               Some(format!("{}::{}{}", self.module_path, first_seg.ident, remaining))
                        } else { None }
                }
        }
@@ -1541,7 +1543,6 @@ impl<'a, 'c: 'a> TypeResolver<'a, 'c> {
        fn empty_val_check_suffix_from_path(&self, full_path: &str) -> Option<&str> {
                match full_path {
                        "secp256k1::PublicKey"|"bitcoin::secp256k1::PublicKey" => Some(".is_null()"),
-                       "bitcoin::secp256k1::ecdsa::Signature" => Some(".is_null()"),
                        _ => None
                }
        }
@@ -3070,7 +3071,9 @@ impl<'a, 'c: 'a> TypeResolver<'a, 'c> {
                                        // If this is a no-export'd crate and there's only one implementation in the
                                        // whole crate, just treat it as a reference to whatever the implementor is.
                                        if with_ref_lifetime {
-                                               write!(w, "&'static crate::{}", trait_impls[0]).unwrap();
+                                               // Hope we're being printed in function generics and let rustc derive the
+                                               // type.
+                                               write!(w, "_").unwrap();
                                        } else {
                                                write!(w, "&crate::{}", trait_impls[0]).unwrap();
                                        }