From 9fd2430c284297016df16a2b4a0a98802cb0fd89 Mon Sep 17 00:00:00 2001 From: Audun Halland Date: Sat, 27 Jul 2024 17:18:58 +0200 Subject: [PATCH] chore: fix new lints --- tests/it/basic.rs | 2 ++ unimock_macros/src/unimock/method.rs | 8 ++++---- unimock_macros/src/unimock/mod.rs | 4 ++-- unimock_macros/src/unimock/output.rs | 4 ++-- unimock_macros/src/unimock/util.rs | 2 -- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/tests/it/basic.rs b/tests/it/basic.rs index 31b0541..29ee5c6 100644 --- a/tests/it/basic.rs +++ b/tests/it/basic.rs @@ -898,6 +898,8 @@ mod eval_name_clash { } mod fn_cfg_attrs { + #![allow(unexpected_cfgs)] + use super::*; #[unimock(api = TraitMock)] diff --git a/unimock_macros/src/unimock/method.rs b/unimock_macros/src/unimock/method.rs index 5030d32..d990f97 100644 --- a/unimock_macros/src/unimock/method.rs +++ b/unimock_macros/src/unimock/method.rs @@ -45,7 +45,7 @@ pub enum InputsSyntax { pub enum ArgClass<'t> { Receiver, - MutImpossible(&'t syn::PatIdent, &'t syn::Type), + MutImpossible(&'t syn::PatIdent), Other(&'t syn::PatIdent, &'t syn::Type), Unprocessable(&'t syn::PatType), } @@ -70,7 +70,7 @@ impl<'t> MockMethod<'t> { if self.method.sig.asyncness.is_some() || matches!( self.output_structure.wrapping, - output::OutputWrapping::AssociatedFuture(_) | output::OutputWrapping::RpitFuture(_) + output::OutputWrapping::AssociatedFuture(_) | output::OutputWrapping::RpitFuture ) { Some(DotAwait) @@ -202,7 +202,7 @@ impl<'t> MockMethod<'t> { syn::FnArg::Typed(pat_type) => match (index, pat_type.pat.as_ref()) { (_, syn::Pat::Ident(pat_ident)) => { if Self::is_mutable_reference_with_lifetimes_in_type(pat_type.ty.as_ref()) { - ArgClass::MutImpossible(pat_ident, &pat_type.ty) + ArgClass::MutImpossible(pat_ident) } else { ArgClass::Other(pat_ident, &pat_type.ty) } @@ -450,7 +450,7 @@ impl<'t> quote::ToTokens for InputsDestructuring<'t> { ArgClass::Receiver => { continue; } - ArgClass::MutImpossible(pat_ident, _) => match self.syntax { + ArgClass::MutImpossible(pat_ident) => match self.syntax { InputsSyntax::FnPattern | InputsSyntax::FnParams | InputsSyntax::EvalPatternAll => pat_ident.to_tokens(tokens), diff --git a/unimock_macros/src/unimock/mod.rs b/unimock_macros/src/unimock/mod.rs index fbb5775..6c34824 100644 --- a/unimock_macros/src/unimock/mod.rs +++ b/unimock_macros/src/unimock/mod.rs @@ -383,7 +383,7 @@ fn def_method_impl( let must_async_wrap = matches!( method.output_structure.wrapping, - output::OutputWrapping::RpitFuture(_) | output::OutputWrapping::AssociatedFuture(_) + output::OutputWrapping::RpitFuture | output::OutputWrapping::AssociatedFuture(_) ); let trait_path = &trait_info.trait_path; @@ -402,7 +402,7 @@ fn def_method_impl( if matches!( method.output_structure.wrapping, - output::OutputWrapping::RpitFuture(_) + output::OutputWrapping::RpitFuture ) { lints.push(quote! { manual_async_fn }); } diff --git a/unimock_macros/src/unimock/output.rs b/unimock_macros/src/unimock/output.rs index 66ee6fb..ad1451d 100644 --- a/unimock_macros/src/unimock/output.rs +++ b/unimock_macros/src/unimock/output.rs @@ -59,7 +59,7 @@ impl OutputStructure { pub enum OutputWrapping { None, - RpitFuture(syn::Type), + RpitFuture, AssociatedFuture(syn::TraitItemType), } @@ -134,7 +134,7 @@ pub fn determine_output_structure( let mut output_structure = determine_owned_or_deep_output_structure(sig, &rpit_future.output.ty, attr); - output_structure.wrapping = OutputWrapping::RpitFuture(rpit_future.output.ty); + output_structure.wrapping = OutputWrapping::RpitFuture; output_structure } else { determine_owned_or_deep_output_structure(sig, output_ty, attr) diff --git a/unimock_macros/src/unimock/util.rs b/unimock_macros/src/unimock/util.rs index bb9dc7e..efd9efe 100644 --- a/unimock_macros/src/unimock/util.rs +++ b/unimock_macros/src/unimock/util.rs @@ -610,7 +610,6 @@ pub fn replace_self_ty_with_path(mut ty: syn::Type, replacement_path: &syn::Path } pub struct FutureBound<'s> { - pub future_ident: &'s syn::Ident, pub output: &'s syn::AssocType, } @@ -642,7 +641,6 @@ pub fn find_future_bound<'s>( .next()?; Some(FutureBound { - future_ident: &last_segment.ident, output: output_assoc, }) }