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 }
}
}
// 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();
}