Skip to content

Commit

Permalink
replace syn::{ .. } with ::syn::{ .. } in macro output
Browse files Browse the repository at this point in the history
  • Loading branch information
sharnoff committed Dec 8, 2020
1 parent 1cb8f49 commit 539dd89
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 20 deletions.
4 changes: 2 additions & 2 deletions src/error_macros.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ macro_rules! handle_syn_result {
Ok(value) => value,
Err(e) => {
let mut ts = quote! {
impl #$generics_intro syn::parse::Parse for #$ident #$generics_args #$where_clause {
fn parse(input: syn::parse::ParseStream) -> syn::Result<Self> {
impl #$generics_intro ::syn::parse::Parse for #$ident #$generics_args #$where_clause {
fn parse(input: ::syn::parse::ParseStream) -> ::syn::Result<Self> {
unimplemented!("failed to derive `Parse`")
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/fields.rs
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,7 @@ fn handle_field_attrs(field_name: &Ident, ty_span: Span, attrs: FieldAttrs) -> P

let macro_name = tree_kind.macro_name();
let tree_name = tree_name(field_name);
parse_expr = quote_spanned! { span=> syn::#macro_name!(#tree_name in #input_source) };
parse_expr = quote_spanned! { span=> ::syn::#macro_name!(#tree_name in #input_source) };
}
}

Expand Down
8 changes: 4 additions & 4 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -387,8 +387,8 @@ pub(crate) fn derive_parse_internal(input: DeriveInput) -> TokenStream {

let parse_input = parse_input();
quote!(
impl #generics_intro syn::parse::Parse for #ident #generics_args #where_clause {
fn parse(#parse_input: syn::parse::ParseStream) -> syn::Result<Self> {
impl #generics_intro ::syn::parse::Parse for #ident #generics_args #where_clause {
fn parse(#parse_input: ::syn::parse::ParseStream) -> ::syn::Result<Self> {
#parse_impl
}
}
Expand Down Expand Up @@ -417,12 +417,12 @@ fn require_impl_parse_if_type(param: &syn::GenericParam) -> Result<TokenStream>
let parse_bound = if colon_token.is_some() {
quote_spanned! {
ident.span()=>
+ syn::parse::Parse
+ ::syn::parse::Parse
}
} else {
quote_spanned! {
ident.span()=>
: syn::parse::Parse
: ::syn::parse::Parse
}
};

Expand Down
26 changes: 13 additions & 13 deletions src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ test_all! {
bar: Bar,
baz: Baz,
}",
"impl syn::parse::Parse for Foo {
fn parse(__parse_input: syn::parse::ParseStream) -> syn::Result<Self> {
"impl ::syn::parse::Parse for Foo {
fn parse(__parse_input: ::syn::parse::ParseStream) -> ::syn::Result<Self> {
let bar = __parse_input.parse()?;
let baz = __parse_input.parse()?;
Expand All @@ -54,10 +54,10 @@ test_all! {
baz: Baz,
quacker: Q,
}",
"impl<B: syn::parse::Parse, Q: Quack + syn::parse::Parse> syn::parse::Parse for Foo<B, Q>
"impl<B: ::syn::parse::Parse, Q: Quack + ::syn::parse::Parse> ::syn::parse::Parse for Foo<B, Q>
where <B as Bar>::Qux: Quack,
{
fn parse(__parse_input: syn::parse::ParseStream) -> syn::Result<Self> {
fn parse(__parse_input: ::syn::parse::ParseStream) -> ::syn::Result<Self> {
let bar = __parse_input.parse()?;
let baz = __parse_input.parse()?;
let quacker = __parse_input.parse()?;
Expand All @@ -78,12 +78,12 @@ test_all! {
#[inside(paren)]
baz: Baz,
}",
"impl syn::parse::Parse for Foo {
fn parse(__parse_input: syn::parse::ParseStream) -> syn::Result<Self> {
"impl ::syn::parse::Parse for Foo {
fn parse(__parse_input: ::syn::parse::ParseStream) -> ::syn::Result<Self> {
let bar = __parse_input.parse()?;
let __paren_backing_token_stream;
let paren = syn::parenthesized!(__paren_backing_token_stream in __parse_input);
let paren = ::syn::parenthesized!(__paren_backing_token_stream in __parse_input);
let baz = __paren_backing_token_stream.parse()?;
Ok(Foo {
Expand All @@ -105,15 +105,15 @@ test_all! {
#[inside(snd)]
baz: Baz,
}",
"impl syn::parse::Parse for Foo {
fn parse(__parse_input: syn::parse::ParseStream) -> syn::Result<Self> {
"impl ::syn::parse::Parse for Foo {
fn parse(__parse_input: ::syn::parse::ParseStream) -> ::syn::Result<Self> {
let bar = __parse_input.parse()?;
let __fst_backing_token_stream;
let fst = syn::bracketed!(__fst_backing_token_stream in __parse_input);
let fst = ::syn::bracketed!(__fst_backing_token_stream in __parse_input);
let __snd_backing_token_stream;
let snd = syn::braced!(__snd_backing_token_stream in __fst_backing_token_stream);
let snd = ::syn::braced!(__snd_backing_token_stream in __fst_backing_token_stream);
let baz = __snd_backing_token_stream.parse()?;
Expand All @@ -132,8 +132,8 @@ test_all! {
#[peek_with(|p| !p.is_empty())]
baz: Baz,
}",
"impl syn::parse::Parse for Foo {
fn parse(__parse_input: syn::parse::ParseStream) -> syn::Result<Self> {
"impl ::syn::parse::Parse for Foo {
fn parse(__parse_input: ::syn::parse::ParseStream) -> ::syn::Result<Self> {
let bar = __parse_input.parse()?;
let baz = match (|p| !p.is_empty())(__parse_input) {
Expand Down

0 comments on commit 539dd89

Please sign in to comment.