@@ -5,7 +5,6 @@ use syn::{parse_macro_input, visit_mut::VisitMut, ImplItem};
55
66struct ReplaceQuestions {
77 name : syn:: Type ,
8- count : usize ,
98}
109
1110impl VisitMut for ReplaceQuestions {
@@ -16,23 +15,22 @@ impl VisitMut for ReplaceQuestions {
1615
1716 // let name = syn::LitStr::new(&self.name, self.span);
1817 let e = & try_expr. expr ;
19- // *i = syn::parse_quote! {
20- // match #e {
21- // ::core::result::Result::Ok(v) => v,
22- // ::core::result::Result::Err(e) => {
23- // panic!(#name);
24- // // return Err(e.context("oh no"));
25- // }
26- // }
27- // };
28-
29- self . count += 1 ;
3018 let name = & self . name ;
31- // let count = &self.count;
32-
3319 * i = syn:: parse_quote! {
34- #e. expect( & format!( "{}.{}" , stringify!( #name) , stringify!( #e) ) )
35- }
20+ match #e {
21+ :: core:: result:: Result :: Ok ( v) => v,
22+ :: core:: result:: Result :: Err ( e) => {
23+ // panic!(#name);
24+ return Err ( :: anyhow:: anyhow!(
25+ format!( "{}\n - {}::{}" , e, stringify!( #name) , stringify!( #e) )
26+ ) ) ;
27+ }
28+ }
29+ } ;
30+
31+ // *i = syn::parse_quote! {
32+ // #e.expect(&format!("{}.{}", stringify!(#name), stringify!(#e)))
33+ // }
3634 }
3735 _ => syn:: visit_mut:: visit_expr_mut ( self , i) ,
3836 }
@@ -48,7 +46,6 @@ pub fn parse_context(_attr: TokenStream, tokens: TokenStream) -> TokenStream {
4846 ImplItem :: Method ( _) => {
4947 let mut replacer = ReplaceQuestions {
5048 name : * input. self_ty . clone ( ) ,
51- count : 0 ,
5249 } ;
5350
5451 replacer. visit_impl_item_mut ( & mut item) ;
0 commit comments