From be2c39b452b8b1e024300caff1ce8f11d54b27ce Mon Sep 17 00:00:00 2001 From: HampusM Date: Fri, 18 Aug 2023 22:37:13 +0200 Subject: test: import proc_macro2 TokenStream in dependency tests Fixes the dependency tests not working on Rust 1.62.1 --- macros/src/injectable/dependency.rs | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) (limited to 'macros/src') diff --git a/macros/src/injectable/dependency.rs b/macros/src/injectable/dependency.rs index 85cad58..8e22f21 100644 --- a/macros/src/injectable/dependency.rs +++ b/macros/src/injectable/dependency.rs @@ -174,8 +174,7 @@ pub enum DependencyError #[cfg(test)] mod tests { - use proc_macro::TokenStream; - use proc_macro2::Span; + use proc_macro2::{Span, TokenStream}; use quote::{format_ident, quote}; use syn::punctuated::Punctuated; use syn::token::{And, Bang, Bracket, Colon, Paren, Pound, SelfValue}; @@ -200,7 +199,7 @@ mod tests assert!(matches!( Dependency::build(&FnArg::Typed(PatType { attrs: vec![], - pat: Box::new(Pat::Verbatim(TokenStream::default().into())), + pat: Box::new(Pat::Verbatim(TokenStream::default())), colon_token: Colon::default(), ty: Box::new(test_utils::create_type(test_utils::create_path(&[ test_utils::create_path_segment( @@ -223,7 +222,7 @@ mod tests assert!(matches!( Dependency::build(&FnArg::Typed(PatType { attrs: vec![], - pat: Box::new(Pat::Verbatim(TokenStream::default().into())), + pat: Box::new(Pat::Verbatim(TokenStream::default())), colon_token: Colon::default(), ty: Box::new(test_utils::create_type(test_utils::create_path(&[ test_utils::create_path_segment(format_ident!("syrette"), &[]), @@ -261,7 +260,7 @@ mod tests )]), tokens: quote! { ("cool") } }], - pat: Box::new(Pat::Verbatim(TokenStream::default().into())), + pat: Box::new(Pat::Verbatim(TokenStream::default())), colon_token: Colon::default(), ty: Box::new(test_utils::create_type(test_utils::create_path(&[ test_utils::create_path_segment( @@ -293,7 +292,7 @@ mod tests )]), tokens: quote! { ("awesome") } }], - pat: Box::new(Pat::Verbatim(TokenStream::default().into())), + pat: Box::new(Pat::Verbatim(TokenStream::default())), colon_token: Colon::default(), ty: Box::new(test_utils::create_type(test_utils::create_path(&[ test_utils::create_path_segment(format_ident!("syrette"), &[]), @@ -333,7 +332,7 @@ mod tests { assert!(Dependency::build(&FnArg::Typed(PatType { attrs: vec![], - pat: Box::new(Pat::Verbatim(TokenStream::default().into())), + pat: Box::new(Pat::Verbatim(TokenStream::default())), colon_token: Colon::default(), ty: Box::new(Type::Tuple(TypeTuple { paren_token: Paren::default(), @@ -349,7 +348,7 @@ mod tests assert!(Dependency::build(&FnArg::Typed(PatType { attrs: vec![], - pat: Box::new(Pat::Verbatim(TokenStream::default().into())), + pat: Box::new(Pat::Verbatim(TokenStream::default())), colon_token: Colon::default(), ty: Box::new(Type::Reference(TypeReference { and_token: And::default(), @@ -368,7 +367,7 @@ mod tests { assert!(Dependency::build(&FnArg::Typed(PatType { attrs: vec![], - pat: Box::new(Pat::Verbatim(TokenStream::default().into())), + pat: Box::new(Pat::Verbatim(TokenStream::default())), colon_token: Colon::default(), ty: Box::new(test_utils::create_type(test_utils::create_path(&[ test_utils::create_path_segment(format_ident!("TransientPtr"), &[]), -- cgit v1.2.3-18-g5258