Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update to syn/quote 1.0 #1591

Merged
merged 1 commit into from Aug 16, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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