@@ -808,10 +808,10 @@ fn writeln_impl<W: std::io::Write>(w: &mut W, i: &syn::ItemImpl, types: &mut Typ
808
808
}
809
809
}
810
810
) ) ;
811
- write ! ( w, "\t }}\n }}\n use {}::{} as {}TraitImport; \n " , types . orig_crate , full_trait_path , trait_obj . ident ) . unwrap ( ) ;
811
+ writeln ! ( w, "\t }}\n }}\n " ) . unwrap ( ) ;
812
812
813
813
macro_rules! impl_meth {
814
- ( $m: expr, $trait: expr, $indent: expr) => {
814
+ ( $m: expr, $trait_path : expr , $ trait: expr, $indent: expr) => {
815
815
let trait_method = $trait. items. iter( ) . filter_map( |item| {
816
816
if let syn:: TraitItem :: Method ( t_m) = item { Some ( t_m) } else { None }
817
817
} ) . find( |trait_meth| trait_meth. sig. ident == $m. sig. ident) . unwrap( ) ;
@@ -842,9 +842,9 @@ fn writeln_impl<W: std::io::Write>(w: &mut W, i: &syn::ItemImpl, types: &mut Typ
842
842
t_gen_args += "_"
843
843
}
844
844
if takes_self {
845
- write!( w, "<native{} as {}TraitImport <{}>>::{}(unsafe {{ &mut *(this_arg as *mut native{}) }}, " , ident, $trait . ident , t_gen_args, $m. sig. ident, ident) . unwrap( ) ;
845
+ write!( w, "<native{} as {}::{} <{}>>::{}(unsafe {{ &mut *(this_arg as *mut native{}) }}, " , ident, types . orig_crate , $trait_path , t_gen_args, $m. sig. ident, ident) . unwrap( ) ;
846
846
} else {
847
- write!( w, "<native{} as {}TraitImport <{}>>::{}(" , ident, $trait . ident , t_gen_args, $m. sig. ident) . unwrap( ) ;
847
+ write!( w, "<native{} as {}::{} <{}>>::{}(" , ident, types . orig_crate , $trait_path , t_gen_args, $m. sig. ident) . unwrap( ) ;
848
848
}
849
849
850
850
let mut real_type = "" . to_string( ) ;
@@ -881,20 +881,19 @@ fn writeln_impl<W: std::io::Write>(w: &mut W, i: &syn::ItemImpl, types: &mut Typ
881
881
for item in i. items . iter ( ) {
882
882
match item {
883
883
syn:: ImplItem :: Method ( m) => {
884
- impl_meth ! ( m, trait_obj, "" ) ;
884
+ impl_meth ! ( m, full_trait_path , trait_obj, "" ) ;
885
885
} ,
886
886
syn:: ImplItem :: Type ( _) => { } ,
887
887
_ => unimplemented ! ( ) ,
888
888
}
889
889
}
890
890
walk_supertraits ! ( trait_obj, Some ( & types) , (
891
- ( s, t ) => {
891
+ ( s, _ ) => {
892
892
if let Some ( supertrait_obj) = types. crate_types. traits. get( s) . cloned( ) {
893
- writeln!( w, "use {}::{} as native{}Trait;" , types. orig_crate, s, t) . unwrap( ) ;
894
893
for item in supertrait_obj. items. iter( ) {
895
894
match item {
896
895
syn:: TraitItem :: Method ( m) => {
897
- impl_meth!( m, supertrait_obj, "\t " ) ;
896
+ impl_meth!( m, s , supertrait_obj, "\t " ) ;
898
897
} ,
899
898
_ => { } ,
900
899
}
0 commit comments