- fn process_use_intern(imports: &mut HashMap<syn::Ident, (String, syn::Path)>, u: &syn::UseTree, partial_path: &str, mut path: syn::punctuated::Punctuated<syn::PathSegment, syn::token::Colon2>) {
+ fn process_use_intern(crate_name: &str, dependencies: &HashSet<syn::Ident>, imports: &mut HashMap<syn::Ident, (String, syn::Path)>,
+ u: &syn::UseTree, partial_path: &str, mut path: syn::punctuated::Punctuated<syn::PathSegment, syn::token::Colon2>) {
+
+ let new_path;
+ macro_rules! push_path {
+ ($ident: expr, $path_suffix: expr) => {
+ if partial_path == "" && !dependencies.contains(&$ident) {
+ new_path = format!("{}::{}{}", crate_name, $ident, $path_suffix);
+ path.push(syn::PathSegment { ident: syn::Ident::new(crate_name, Span::call_site()), arguments: syn::PathArguments::None });
+ } else {
+ new_path = format!("{}{}{}", partial_path, $ident, $path_suffix);
+ }
+ path.push(syn::PathSegment { ident: $ident.clone(), arguments: syn::PathArguments::None });
+ }
+ }