Skip to content

Commit

Permalink
Merge pull request #1591 from dtolnay/up
Browse files Browse the repository at this point in the history
Update to syn/quote 1.0
  • Loading branch information
dtolnay committed Aug 16, 2019
2 parents 8ad6ae7 + 3ea85a2 commit 7dceee6
Show file tree
Hide file tree
Showing 7 changed files with 160 additions and 142 deletions.
6 changes: 3 additions & 3 deletions serde_derive/Cargo.toml
Expand Up @@ -24,9 +24,9 @@ name = "serde_derive"
proc-macro = true

[dependencies]
proc-macro2 = "0.4"
quote = "0.6.3"
syn = { version = "0.15.22", features = ["visit"] }
proc-macro2 = "1.0"
quote = "1.0"
syn = { version = "1.0", features = ["visit"] }

[dev-dependencies]
serde = { version = "1.0", path = "../serde" }
4 changes: 2 additions & 2 deletions serde_derive/src/bound.rs
Expand Up @@ -115,7 +115,7 @@ pub fn with_bound(
impl<'ast> Visit<'ast> for FindTyParams<'ast> {
fn visit_field(&mut self, field: &'ast syn::Field) {
if let syn::Type::Path(ref ty) = field.ty {
if let Some(Pair::Punctuated(ref t, _)) = ty.path.segments.first() {
if let Some(Pair::Punctuated(ref t, _)) = ty.path.segments.pairs().next() {
if self.all_type_params.contains(&t.ident) {
self.associated_type_usage.push(ty);
}
Expand All @@ -126,7 +126,7 @@ pub fn with_bound(

fn visit_path(&mut self, path: &'ast syn::Path) {
if let Some(seg) = path.segments.last() {
if seg.into_value().ident == "PhantomData" {
if seg.ident == "PhantomData" {
// Hardcoded exception, because PhantomData<T> implements
// Serialize and Deserialize whether or not T implements it.
return;
Expand Down
2 changes: 1 addition & 1 deletion serde_derive/src/de.rs
Expand Up @@ -145,7 +145,7 @@ impl Parameters {
/// Type name to use in error messages and `&'static str` arguments to
/// various Deserializer methods.
fn type_name(&self) -> String {
self.this.segments.last().unwrap().value().ident.to_string()
self.this.segments.last().unwrap().ident.to_string()
}
}

Expand Down
280 changes: 146 additions & 134 deletions serde_derive/src/internals/attr.rs

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion serde_derive/src/internals/check.rs
Expand Up @@ -407,7 +407,7 @@ fn member_message(member: &Member) -> String {
fn allow_transparent(field: &Field, derive: Derive) -> bool {
if let Type::Path(ref ty) = *field.ty {
if let Some(seg) = ty.path.segments.last() {
if seg.into_value().ident == "PhantomData" {
if seg.ident == "PhantomData" {
return false;
}
}
Expand Down
6 changes: 6 additions & 0 deletions serde_derive/src/internals/symbol.rs
Expand Up @@ -54,6 +54,12 @@ impl PartialEq<Symbol> for Path {
}
}

impl<'a> PartialEq<Symbol> for &'a Path {
fn eq(&self, word: &Symbol) -> bool {
self.is_ident(word.0)
}
}

impl Display for Symbol {
fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
formatter.write_str(self.0)
Expand Down
2 changes: 1 addition & 1 deletion serde_derive/src/ser.rs
Expand Up @@ -116,7 +116,7 @@ impl Parameters {
/// Type name to use in error messages and `&'static str` arguments to
/// various Serializer methods.
fn type_name(&self) -> String {
self.this.segments.last().unwrap().value().ident.to_string()
self.this.segments.last().unwrap().ident.to_string()
}
}

Expand Down

0 comments on commit 7dceee6

Please sign in to comment.