- if resolved.starts_with("ln::") || resolved.starts_with("chain::") || resolved.starts_with("util::") {
- write!(w, "lightning::{}", resolved).unwrap();
+ // TODO: We should have a generic "is from a dependency" check here instead of
+ // checking for "bitcoin" explicitly.
+ if resolved.starts_with("bitcoin::") || Self::in_rust_prelude(&resolved) {
+ write!(w, "{}", resolved).unwrap();
+ // If we're printing a generic argument, it needs to reference the crate, otherwise
+ // the original crate:
+ } else if self.maybe_resolve_path(&path, None).as_ref() == Some(&resolved) {
+ write!(w, "{}::{}", self.orig_crate, resolved).unwrap();