Skip to content

Commit

Permalink
chore: fix new lints
Browse files Browse the repository at this point in the history
  • Loading branch information
audunhalland committed Jul 27, 2024
1 parent 9ef8ca8 commit 9fd2430
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 10 deletions.
2 changes: 2 additions & 0 deletions tests/it/basic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -898,6 +898,8 @@ mod eval_name_clash {
}

mod fn_cfg_attrs {
#![allow(unexpected_cfgs)]

use super::*;

#[unimock(api = TraitMock)]
Expand Down
8 changes: 4 additions & 4 deletions unimock_macros/src/unimock/method.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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),
}
Expand All @@ -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)
Expand Down Expand Up @@ -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)
}
Expand Down Expand Up @@ -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),
Expand Down
4 changes: 2 additions & 2 deletions unimock_macros/src/unimock/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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 });
}
Expand Down
4 changes: 2 additions & 2 deletions unimock_macros/src/unimock/output.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ impl OutputStructure {

pub enum OutputWrapping {
None,
RpitFuture(syn::Type),
RpitFuture,
AssociatedFuture(syn::TraitItemType),
}

Expand Down Expand Up @@ -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)
Expand Down
2 changes: 0 additions & 2 deletions unimock_macros/src/unimock/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
}

Expand Down Expand Up @@ -642,7 +641,6 @@ pub fn find_future_bound<'s>(
.next()?;

Some(FutureBound {
future_ident: &last_segment.ident,
output: output_assoc,
})
}
Expand Down

0 comments on commit 9fd2430

Please sign in to comment.