Fix derive on ErrorKind
This commit is contained in:
parent
1d81b59163
commit
232e82cd30
@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "ctxerr"
|
||||
version = "0.2.3"
|
||||
version = "0.2.5"
|
||||
authors = ["Andrey Tkachenko <andrey@aidev.ru>"]
|
||||
repository = "https://github.com/andreytkachenko/ctxerr.git"
|
||||
keywords = ["error", "handling", "thiserror", "context", "backtrace"]
|
||||
@ -15,5 +15,5 @@ resolver = "2"
|
||||
members = ["derive"]
|
||||
|
||||
[dependencies]
|
||||
ctxerr_derive = {version = "0.4.0", path = "derive"}
|
||||
ctxerr_derive = {version = "0.5.0", path = "derive"}
|
||||
thiserror = "1.0.40"
|
||||
|
@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "ctxerr_derive"
|
||||
version = "0.4.0"
|
||||
version = "0.5.0"
|
||||
authors = ["Andrey Tkachenko <andrey@aidev.ru>"]
|
||||
repository = "https://github.com/andreytkachenko/ctxerr.git"
|
||||
keywords = ["error", "handling", "thiserror", "context", "backtrace"]
|
||||
|
@ -11,7 +11,7 @@ pub fn ctxerr(
|
||||
_metadata: proc_macro::TokenStream,
|
||||
input: proc_macro::TokenStream,
|
||||
) -> proc_macro::TokenStream {
|
||||
let mut ast: DeriveInput = syn::parse(input).unwrap();
|
||||
let ast: DeriveInput = syn::parse(input).unwrap();
|
||||
let name = ast.ident.to_string();
|
||||
if !name.ends_with("Kind") {
|
||||
panic!("Ttypename should ends with `Kind`!");
|
||||
@ -21,7 +21,8 @@ pub fn ctxerr(
|
||||
let base_name = Ident::new(&name[0..name.len() - 4], ast.ident.span());
|
||||
let attrs = ast
|
||||
.attrs
|
||||
.drain(..)
|
||||
.iter()
|
||||
.cloned()
|
||||
.filter_map(|x| match x.meta {
|
||||
syn::Meta::List(list) => Some(list.tokens),
|
||||
_ => None,
|
||||
|
Loading…
Reference in New Issue
Block a user