From 4d151f71cc792709203aafc18d224b0163af6477 Mon Sep 17 00:00:00 2001 From: Basti Ortiz Date: Mon, 8 Aug 2022 18:04:11 +0800 Subject: [PATCH 1/2] Deps: update `heck` to `0.4` --- argh_derive/Cargo.toml | 2 +- argh_derive/src/lib.rs | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/argh_derive/Cargo.toml b/argh_derive/Cargo.toml index 0c9eb8e..2294c70 100644 --- a/argh_derive/Cargo.toml +++ b/argh_derive/Cargo.toml @@ -12,7 +12,7 @@ readme = "README.md" proc-macro = true [dependencies] -heck = "0.3.1" +heck = "0.4" proc-macro2 = "1.0" quote = "1.0" syn = "1.0" diff --git a/argh_derive/src/lib.rs b/argh_derive/src/lib.rs index 2e5f1ec..c0cb978 100644 --- a/argh_derive/src/lib.rs +++ b/argh_derive/src/lib.rs @@ -184,7 +184,10 @@ impl<'a> StructField<'a> { .long .as_ref() .map(syn::LitStr::value) - .unwrap_or_else(|| heck::KebabCase::to_kebab_case(&*name.to_string())); + .unwrap_or_else(|| { + use heck::ToKebabCase; + name.to_string().to_kebab_case() + }); if long_name == "help" { errors.err(field, "Custom `--help` flags are not supported."); } From d28aafa57069f85ee1bbe65002652a0324eb4d68 Mon Sep 17 00:00:00 2001 From: Basti Ortiz <39114273+Some-Dood@users.noreply.github.com> Date: Wed, 10 Aug 2022 18:07:15 +0800 Subject: [PATCH 2/2] Chore: move `use` to top level --- argh_derive/src/lib.rs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/argh_derive/src/lib.rs b/argh_derive/src/lib.rs index c0cb978..7dc5f32 100644 --- a/argh_derive/src/lib.rs +++ b/argh_derive/src/lib.rs @@ -13,6 +13,7 @@ use { errors::Errors, parse_attrs::{FieldAttrs, FieldKind, TypeAttrs}, }, + heck::ToKebabCase, proc_macro2::{Span, TokenStream}, quote::{quote, quote_spanned, ToTokens}, std::{collections::HashMap, str::FromStr}, @@ -184,10 +185,7 @@ impl<'a> StructField<'a> { .long .as_ref() .map(syn::LitStr::value) - .unwrap_or_else(|| { - use heck::ToKebabCase; - name.to_string().to_kebab_case() - }); + .unwrap_or_else(|| name.to_string().to_kebab_case()); if long_name == "help" { errors.err(field, "Custom `--help` flags are not supported."); }