diff options
author | David Tolnay <dtolnay@gmail.com> | 2018-05-20 18:10:38 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-05-20 18:10:38 -0700 |
commit | 857e7e711f8217e04d64bc0eacad9e1e20b93aef (patch) | |
tree | b8569d2f164bc940ea3cca8b5a5cca0d23630275 /src/path.rs | |
parent | 5efb787c53a684546a5d8e7e49b50fd271f65374 (diff) | |
parent | 55a5f3a7cf42e52f050e0b01e93d8d23bee8365d (diff) | |
download | syn-857e7e711f8217e04d64bc0eacad9e1e20b93aef.tar.gz |
Merge pull request #426 from alexcrichton/next
Update to the next version of proc-macro2
Diffstat (limited to 'src/path.rs')
-rw-r--r-- | src/path.rs | 25 |
1 files changed, 14 insertions, 11 deletions
diff --git a/src/path.rs b/src/path.rs index 9ad8e71a..cded4359 100644 --- a/src/path.rs +++ b/src/path.rs @@ -31,9 +31,11 @@ impl Path { /// ```rust /// extern crate syn; /// extern crate quote; +/// extern crate proc_macro2; /// /// use syn::{QSelf, Path, PathTokens}; -/// use quote::{Tokens, ToTokens}; +/// use proc_macro2::TokenStream; +/// use quote::ToTokens; /// /// struct MyNode { /// qself: Option<QSelf>, @@ -41,7 +43,7 @@ impl Path { /// } /// /// impl ToTokens for MyNode { -/// fn to_tokens(&self, tokens: &mut Tokens) { +/// fn to_tokens(&self, tokens: &mut TokenStream) { /// PathTokens(&self.qself, &self.path).to_tokens(tokens); /// } /// } @@ -416,24 +418,25 @@ pub mod parsing { #[cfg(feature = "printing")] mod printing { use super::*; - use quote::{ToTokens, Tokens}; + use quote::ToTokens; + use proc_macro2::TokenStream; impl ToTokens for Path { - fn to_tokens(&self, tokens: &mut Tokens) { + fn to_tokens(&self, tokens: &mut TokenStream) { self.leading_colon.to_tokens(tokens); self.segments.to_tokens(tokens); } } impl ToTokens for PathSegment { - fn to_tokens(&self, tokens: &mut Tokens) { + fn to_tokens(&self, tokens: &mut TokenStream) { self.ident.to_tokens(tokens); self.arguments.to_tokens(tokens); } } impl ToTokens for PathArguments { - fn to_tokens(&self, tokens: &mut Tokens) { + fn to_tokens(&self, tokens: &mut TokenStream) { match *self { PathArguments::None => {} PathArguments::AngleBracketed(ref arguments) => { @@ -448,7 +451,7 @@ mod printing { impl ToTokens for GenericArgument { #[cfg_attr(feature = "cargo-clippy", allow(match_same_arms))] - fn to_tokens(&self, tokens: &mut Tokens) { + fn to_tokens(&self, tokens: &mut TokenStream) { match *self { GenericArgument::Lifetime(ref lt) => lt.to_tokens(tokens), GenericArgument::Type(ref ty) => ty.to_tokens(tokens), @@ -473,7 +476,7 @@ mod printing { } impl ToTokens for AngleBracketedGenericArguments { - fn to_tokens(&self, tokens: &mut Tokens) { + fn to_tokens(&self, tokens: &mut TokenStream) { self.colon2_token.to_tokens(tokens); self.lt_token.to_tokens(tokens); @@ -516,7 +519,7 @@ mod printing { } impl ToTokens for Binding { - fn to_tokens(&self, tokens: &mut Tokens) { + fn to_tokens(&self, tokens: &mut TokenStream) { self.ident.to_tokens(tokens); self.eq_token.to_tokens(tokens); self.ty.to_tokens(tokens); @@ -524,7 +527,7 @@ mod printing { } impl ToTokens for ParenthesizedGenericArguments { - fn to_tokens(&self, tokens: &mut Tokens) { + fn to_tokens(&self, tokens: &mut TokenStream) { self.paren_token.surround(tokens, |tokens| { self.inputs.to_tokens(tokens); }); @@ -533,7 +536,7 @@ mod printing { } impl<'a> ToTokens for PathTokens<'a> { - fn to_tokens(&self, tokens: &mut Tokens) { + fn to_tokens(&self, tokens: &mut TokenStream) { let qself = match *self.0 { Some(ref qself) => qself, None => return self.1.to_tokens(tokens), |