+#![allow(clippy::uninlined_format_args)]
+
#[macro_use]
mod macros;
use proc_macro2::{Delimiter, Group, Ident, Span, TokenStream, TokenTree};
use quote::quote;
-use std::iter::FromIterator;
use syn::{Item, ItemTrait};
#[test]
Item::Fn {
attrs: [
Attribute {
- style: Outer,
- path: Path {
+ style: AttrStyle::Outer,
+ meta: Meta::Path {
segments: [
PathSegment {
ident: "test",
- arguments: None,
},
],
},
- tokens: TokenStream(``),
},
],
- vis: Inherited,
+ vis: Visibility::Inherited,
sig: Signature {
ident: "f",
generics: Generics,
- output: Default,
+ output: ReturnType::Default,
},
block: Block,
}
snapshot!(tokens as Item, @r###"
Item::Impl {
generics: Generics,
- self_ty: Verbatim(`! Trait`),
+ self_ty: Type::Verbatim(`! Trait`),
}
"###);
segments: [
PathSegment {
ident: "Trait",
- arguments: None,
},
],
},
segments: [
PathSegment {
ident: "T",
- arguments: None,
},
],
},
snapshot!(tokens as Item, @r###"
Item::Impl {
generics: Generics,
- self_ty: Verbatim(`! !`),
+ self_ty: Type::Verbatim(`! !`),
}
"###);
}
segments: [
PathSegment {
ident: "Trait",
- arguments: None,
},
],
},
segments: [
PathSegment {
ident: "Type",
- arguments: None,
},
],
},
let tokens = quote!(trait Trait where {});
snapshot!(tokens as ItemTrait, @r###"
ItemTrait {
- vis: Inherited,
+ vis: Visibility::Inherited,
ident: "Trait",
generics: Generics {
where_clause: Some(WhereClause),
let tokens = quote!(trait Trait: where {});
snapshot!(tokens as ItemTrait, @r###"
ItemTrait {
- vis: Inherited,
+ vis: Visibility::Inherited,
ident: "Trait",
generics: Generics {
where_clause: Some(WhereClause),
let tokens = quote!(trait Trait: Sized where {});
snapshot!(tokens as ItemTrait, @r###"
ItemTrait {
- vis: Inherited,
+ vis: Visibility::Inherited,
ident: "Trait",
generics: Generics {
where_clause: Some(WhereClause),
},
colon_token: Some,
supertraits: [
- Trait(TraitBound {
- modifier: None,
+ TypeParamBound::Trait(TraitBound {
path: Path {
segments: [
PathSegment {
ident: "Sized",
- arguments: None,
},
],
},
let tokens = quote!(trait Trait: Sized + where {});
snapshot!(tokens as ItemTrait, @r###"
ItemTrait {
- vis: Inherited,
+ vis: Visibility::Inherited,
ident: "Trait",
generics: Generics {
where_clause: Some(WhereClause),
},
colon_token: Some,
supertraits: [
- Trait(TraitBound {
- modifier: None,
+ TypeParamBound::Trait(TraitBound {
path: Path {
segments: [
PathSegment {
ident: "Sized",
- arguments: None,
},
],
},
snapshot!(tokens as ItemTrait, @r###"
ItemTrait {
- vis: Inherited,
+ vis: Visibility::Inherited,
ident: "Foo",
generics: Generics,
items: [
pub default unsafe impl union {}
};
- snapshot!(tokens as Item, @"Verbatim(`pub default unsafe impl union { }`)");
+ snapshot!(tokens as Item, @"Item::Verbatim(`pub default unsafe impl union { }`)");
}
#[test]
generics: Generics {
lt_token: Some,
params: [
- Type(TypeParam {
+ GenericParam::Type(TypeParam {
ident: "T",
eq_token: Some,
default: Some(Type::Tuple),
gt_token: Some,
},
self_ty: Type::Tuple,
- }"###);
+ }
+ "###);
}
#[test]
snapshot!(tokens as Item, @r###"
Item::Fn {
- vis: Inherited,
+ vis: Visibility::Inherited,
sig: Signature {
ident: "f",
generics: Generics,
- output: Type(
+ output: ReturnType::Type(
Type::ImplTrait {
bounds: [
- Trait(TraitBound {
- modifier: None,
+ TypeParamBound::Trait(TraitBound {
path: Path {
segments: [
PathSegment {
ident: "Sized",
- arguments: None,
},
],
},