From 79a6479334e3650207894a4abde1b242e32e7130 Mon Sep 17 00:00:00 2001 From: Shane Pearman Date: Sun, 25 Aug 2019 05:42:19 -0700 Subject: [PATCH] Update dependencies --- parse-display-derive/Cargo.toml | 6 +++--- parse-display-derive/src/lib.rs | 28 ++++++++++++++-------------- 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/parse-display-derive/Cargo.toml b/parse-display-derive/Cargo.toml index f0983f9..bdcaf5b 100644 --- a/parse-display-derive/Cargo.toml +++ b/parse-display-derive/Cargo.toml @@ -15,9 +15,9 @@ edition = "2018" proc-macro = true [dependencies] -syn = "0.15" -quote = "0.6" -proc-macro2 = "0.4" +syn = "1.0" +quote = "1.0" +proc-macro2 = "1.0" regex = "1" regex-syntax = "0.6" lazy_static = "1.3" diff --git a/parse-display-derive/src/lib.rs b/parse-display-derive/src/lib.rs index 6e23760..5c6e62f 100644 --- a/parse-display-derive/src/lib.rs +++ b/parse-display-derive/src/lib.rs @@ -561,23 +561,23 @@ impl HelperAttributes { for a in attrs { let m = a.parse_meta().unwrap(); match &m { - Meta::List(ml) if ml.ident == "display" => { + Meta::List(ml) if ml.path.get_ident().map(|ident| ident == "display").unwrap_or(false) => { for m in ml.nested.iter() { has.set_display_nested_meta(m); } } - Meta::NameValue(nv) if nv.ident == "display" => { + Meta::NameValue(nv) if nv.path.get_ident().map(|ident| ident == "display").unwrap_or(false) => { panic!( "`#[display = ..]` is not allowed. \n{}", DISPLAY_HELPER_USAGE ); } - Meta::List(ml) if ml.ident == "from_str" => { + Meta::List(ml) if ml.path.get_ident().map(|ident| ident == "from_str").unwrap_or(false) => { for m in ml.nested.iter() { has.set_from_str_nested_meta(m); } } - Meta::NameValue(nv) if nv.ident == "from_str" => { + Meta::NameValue(nv) if nv.path.get_ident().map(|ident| ident == "from_str").unwrap_or(false) => { panic!( "`#[from_str = ..]` is not allowed. \n{}", FROM_STR_HELPER_USAGE @@ -590,17 +590,17 @@ impl HelperAttributes { } fn set_display_nested_meta(&mut self, m: &NestedMeta) { match m { - NestedMeta::Literal(Lit::Str(s)) => { + NestedMeta::Lit(Lit::Str(s)) => { if self.format.is_some() { panic!("display format can be specified only once.") } self.format = Some(DisplayFormat::from(&s.value())); } NestedMeta::Meta(Meta::NameValue(MetaNameValue { - ident, + path, lit: Lit::Str(s), .. - })) if ident == "style" => { + })) if path.get_ident().map(|ident| ident == "style").unwrap_or(false) => { if self.style.is_some() { panic!("display style can be specified only once."); } @@ -618,26 +618,26 @@ impl HelperAttributes { fn set_from_str_nested_meta(&mut self, m: &NestedMeta) { match m { NestedMeta::Meta(Meta::NameValue(MetaNameValue { - ident, + path, lit: Lit::Str(s), .. - })) if ident == "regex" => { + })) if path.get_ident().map(|ident| ident == "regex").unwrap_or(false) => { if self.regex.is_some() { panic!("from_str regex can be specified only once."); } self.regex = Some(s.value()); } - NestedMeta::Meta(Meta::Word(ident)) if ident == "default" => { + NestedMeta::Meta(Meta::Path(path)) if path.get_ident().map(|ident| ident == "default").unwrap_or(false) => { self.default_self = true; } - NestedMeta::Meta(Meta::List(l)) if l.ident == "default_fields" => { + NestedMeta::Meta(Meta::List(l)) if l.path.get_ident().map(|ident| ident == "default_fields").unwrap_or(false) => { for m in l.nested.iter() { match m { - NestedMeta::Literal(Lit::Str(s)) => { + NestedMeta::Lit(Lit::Str(s)) => { self.default_fields.push(s.value()); } - NestedMeta::Meta(Meta::Word(ident)) => { - self.default_fields.push(ident.to_string()); + NestedMeta::Meta(Meta::Path(path)) => { + path.get_ident().map(|ident| self.default_fields.push(ident.to_string())); } _ => { panic!(