summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Cargo.toml4
-rw-r--r--parsebyregex-derive/Cargo.toml8
-rw-r--r--parsebyregex-derive/src/lib.rs10
3 files changed, 12 insertions, 10 deletions
diff --git a/Cargo.toml b/Cargo.toml
index e1f3cc8..2f242b4 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -11,5 +11,5 @@ members = [
]
[dependencies]
-regex = "1.1"
-lazy_static = "1.2"
+regex = "1.3"
+lazy_static = "1.4"
diff --git a/parsebyregex-derive/Cargo.toml b/parsebyregex-derive/Cargo.toml
index ea58f9f..cebfc8c 100644
--- a/parsebyregex-derive/Cargo.toml
+++ b/parsebyregex-derive/Cargo.toml
@@ -8,10 +8,10 @@ edition = "2018"
proc-macro = true
[dependencies]
-syn = {version="0.15", features=["derive","parsing","printing"]}
-quote = "0.6"
-regex = "1.1"
-proc-macro2 = "0.4"
+syn = {version="1.0", features=["derive","parsing","printing"]}
+quote = "1.0"
+regex = "1.3"
+proc-macro2 = "1.0"
[dev-dependencies]
parsebyregex = {path = ".."} \ No newline at end of file
diff --git a/parsebyregex-derive/src/lib.rs b/parsebyregex-derive/src/lib.rs
index 38381bf..8cd5e84 100644
--- a/parsebyregex-derive/src/lib.rs
+++ b/parsebyregex-derive/src/lib.rs
@@ -24,7 +24,8 @@ fn impl_pbr_macro(ast: &syn::DeriveInput) -> TokenStream {
let body = gen_struct_body(&name, &regex);
quote! {
impl ParseByRegex for #name {
- fn parse_by_regex<T: AsRef<str>>(input: T) -> std::result::Result<Self, Box<std::error::Error>> {
+ #[allow(clippy::trivial_regex)]
+ fn parse_by_regex<T: AsRef<str>>(input: T) -> std::result::Result<Self, Box<dyn std::error::Error>> {
use parsebyregex::lazy_static;
use parsebyregex::Regex;
lazy_static! {
@@ -33,7 +34,7 @@ fn impl_pbr_macro(ast: &syn::DeriveInput) -> TokenStream {
if let Some(captures) = PARSER.captures(input.as_ref()) {
#body
} else {
- Err(format!("Unable to parse `{}` by `{}`", input.as_ref(), #regex))?
+ Err(format!("Unable to parse `{}` by `{}`", input.as_ref(), #regex).into())
}
}
}
@@ -49,7 +50,8 @@ fn impl_pbr_macro(ast: &syn::DeriveInput) -> TokenStream {
let body = gen_enum_body(&name, &edata);
quote! {
impl ParseByRegex for #name {
- fn parse_by_regex<T: AsRef<str>>(input: T) -> std::result::Result<Self, Box<std::error::Error>> {
+ #[allow(clippy::trivial_regex)]
+ fn parse_by_regex<T: AsRef<str>>(input: T) -> std::result::Result<Self, Box<dyn std::error::Error>> {
use parsebyregex::lazy_static;
use parsebyregex::Regex;
lazy_static! {
@@ -332,7 +334,7 @@ fn gen_enum_body(name: &syn::Ident, edata: &syn::DataEnum) -> proc_macro2::Token
quote! {
#(#parsers else)* {
- Err(format!("Unable to parse `{}` as {}", input.as_ref(), #strname))?
+ Err(format!("Unable to parse `{}` as {}", input.as_ref(), #strname).into())
}
}
}