diff options
Diffstat (limited to 'vendor/syn/tests/test_item.rs')
-rw-r--r-- | vendor/syn/tests/test_item.rs | 54 |
1 files changed, 22 insertions, 32 deletions
diff --git a/vendor/syn/tests/test_item.rs b/vendor/syn/tests/test_item.rs index 96df4b1aa..9b0e1c9ff 100644 --- a/vendor/syn/tests/test_item.rs +++ b/vendor/syn/tests/test_item.rs @@ -1,9 +1,10 @@ +#![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] @@ -21,23 +22,21 @@ fn test_macro_variable_attr() { 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, } @@ -69,7 +68,7 @@ fn test_negative_impl() { snapshot!(tokens as Item, @r###" Item::Impl { generics: Generics, - self_ty: Verbatim(`! Trait`), + self_ty: Type::Verbatim(`! Trait`), } "###); @@ -87,7 +86,6 @@ fn test_negative_impl() { segments: [ PathSegment { ident: "Trait", - arguments: None, }, ], }, @@ -97,7 +95,6 @@ fn test_negative_impl() { segments: [ PathSegment { ident: "T", - arguments: None, }, ], }, @@ -114,7 +111,7 @@ fn test_negative_impl() { snapshot!(tokens as Item, @r###" Item::Impl { generics: Generics, - self_ty: Verbatim(`! !`), + self_ty: Type::Verbatim(`! !`), } "###); } @@ -139,7 +136,6 @@ fn test_macro_variable_impl() { segments: [ PathSegment { ident: "Trait", - arguments: None, }, ], }, @@ -150,7 +146,6 @@ fn test_macro_variable_impl() { segments: [ PathSegment { ident: "Type", - arguments: None, }, ], }, @@ -168,7 +163,7 @@ fn test_supertraits() { 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), @@ -180,7 +175,7 @@ fn test_supertraits() { 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), @@ -193,20 +188,18 @@ fn test_supertraits() { 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, }, ], }, @@ -219,20 +212,18 @@ fn test_supertraits() { 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, }, ], }, @@ -253,7 +244,7 @@ fn test_type_empty_bounds() { snapshot!(tokens as ItemTrait, @r###" ItemTrait { - vis: Inherited, + vis: Visibility::Inherited, ident: "Foo", generics: Generics, items: [ @@ -273,7 +264,7 @@ fn test_impl_visibility() { 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] @@ -288,7 +279,7 @@ fn test_impl_type_parameter_defaults() { generics: Generics { lt_token: Some, params: [ - Type(TypeParam { + GenericParam::Type(TypeParam { ident: "T", eq_token: Some, default: Some(Type::Tuple), @@ -297,7 +288,8 @@ fn test_impl_type_parameter_defaults() { gt_token: Some, }, self_ty: Type::Tuple, - }"###); + } + "###); } #[test] @@ -308,20 +300,18 @@ fn test_impl_trait_trailing_plus() { 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, }, ], }, |