Update ui tests auxiliary to syn 2.0

This commit is contained in:
Deadbeef 2023-04-12 08:51:11 +08:00
parent 4026dde4e5
commit 3813b8e10d
2 changed files with 3 additions and 3 deletions

View File

@ -49,7 +49,7 @@ if_chain = "1.0"
itertools = "0.10.1" itertools = "0.10.1"
quote = "1.0" quote = "1.0"
serde = { version = "1.0.125", features = ["derive"] } serde = { version = "1.0.125", features = ["derive"] }
syn = { version = "1.0", features = ["full"] } syn = { version = "2.0", features = ["full"] }
futures = "0.3" futures = "0.3"
parking_lot = "0.12" parking_lot = "0.12"
tokio = { version = "1", features = ["io-util"] } tokio = { version = "1", features = ["io-util"] }

View File

@ -28,7 +28,7 @@ pub fn dummy(_args: TokenStream, input: TokenStream) -> TokenStream {
pub fn fake_async_trait(_args: TokenStream, input: TokenStream) -> TokenStream { pub fn fake_async_trait(_args: TokenStream, input: TokenStream) -> TokenStream {
let mut item = parse_macro_input!(input as ItemTrait); let mut item = parse_macro_input!(input as ItemTrait);
for inner in &mut item.items { for inner in &mut item.items {
if let TraitItem::Method(method) = inner { if let TraitItem::Fn(method) = inner {
let sig = &method.sig; let sig = &method.sig;
let block = &mut method.default; let block = &mut method.default;
if let Some(block) = block { if let Some(block) = block {
@ -70,7 +70,7 @@ fn mut_receiver_of(sig: &mut Signature) -> Option<&mut FnArg> {
// Look for methods having arbitrary self type taken by &mut ref // Look for methods having arbitrary self type taken by &mut ref
for inner in &mut item.items { for inner in &mut item.items {
if let ImplItem::Method(method) = inner { if let ImplItem::Fn(method) = inner {
if let Some(FnArg::Typed(pat_type)) = mut_receiver_of(&mut method.sig) { if let Some(FnArg::Typed(pat_type)) = mut_receiver_of(&mut method.sig) {
if let box Type::Reference(reference) = &mut pat_type.ty { if let box Type::Reference(reference) = &mut pat_type.ty {
// Target only unnamed lifetimes // Target only unnamed lifetimes