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