From: Matt Corallo Date: Sun, 18 Apr 2021 00:43:21 +0000 (+0000) Subject: Handle type resolution of `crate::thing` without a `use crate` X-Git-Tag: v0.0.98~10^2~13 X-Git-Url: http://git.bitcoin.ninja/?a=commitdiff_plain;h=7f4d9fcc3bb550089a4244c817e24bc853757365;p=ldk-c-bindings Handle type resolution of `crate::thing` without a `use crate` --- diff --git a/c-bindings-gen/src/types.rs b/c-bindings-gen/src/types.rs index b0a410e..567cc7d 100644 --- a/c-bindings-gen/src/types.rs +++ b/c-bindings-gen/src/types.rs @@ -517,9 +517,7 @@ impl<'mod_lifetime, 'crate_lft: 'mod_lifetime> ImportResolver<'mod_lifetime, 'cr format!("::{}", seg.ident) }).collect(); let first_seg_str = format!("{}", first_seg.ident); - if first_seg_str == "std" { - Some(first_seg_str + &remaining) - } else if let Some((imp, _)) = self.imports.get(&first_seg.ident) { + if let Some((imp, _)) = self.imports.get(&first_seg.ident) { if remaining != "" { Some(imp.clone() + &remaining) } else { @@ -527,6 +525,8 @@ impl<'mod_lifetime, 'crate_lft: 'mod_lifetime> ImportResolver<'mod_lifetime, 'cr } } else if let Some(_) = self.priv_modules.get(&first_seg.ident) { Some(format!("{}::{}{}", self.module_path, first_seg.ident, remaining)) + } else if first_seg_str == "std" || self.dependencies.contains(&first_seg.ident) { + Some(first_seg_str + &remaining) } else { None } } }