msrv: remove use of matches! macro

This commit is contained in:
David Hewitt 2021-03-12 07:28:49 +00:00
parent b75a8f6e8b
commit e55fe205ed

View file

@ -28,10 +28,9 @@ impl<'a> FnArg<'a> {
bail_spanned!(recv.span() => "unexpected receiver") bail_spanned!(recv.span() => "unexpected receiver")
} // checked in parse_fn_type } // checked in parse_fn_type
syn::FnArg::Typed(cap) => { syn::FnArg::Typed(cap) => {
ensure_spanned!( if let syn::Type::ImplTrait(_) = &*cap.ty {
!matches!(&*cap.ty, syn::Type::ImplTrait(_)), bail_spanned!(cap.ty.span() => IMPL_TRAIT_ERR);
cap.ty.span() => IMPL_TRAIT_ERR }
);
let arg_attrs = PyFunctionArgAttrs::from_attrs(&mut cap.attrs)?; let arg_attrs = PyFunctionArgAttrs::from_attrs(&mut cap.attrs)?;
let (ident, by_ref, mutability) = match *cap.pat { let (ident, by_ref, mutability) = match *cap.pat {
@ -149,10 +148,9 @@ pub fn parse_method_receiver(arg: &syn::FnArg) -> syn::Result<SelfType> {
mutable: recv.mutability.is_some(), mutable: recv.mutability.is_some(),
}), }),
syn::FnArg::Typed(syn::PatType { ty, .. }) => { syn::FnArg::Typed(syn::PatType { ty, .. }) => {
ensure_spanned!( if let syn::Type::ImplTrait(_) = &**ty {
!matches!(&**ty, syn::Type::ImplTrait(_)), bail_spanned!(ty.span() => IMPL_TRAIT_ERR);
ty.span() => IMPL_TRAIT_ERR }
);
Ok(SelfType::TryFromPyCell(ty.span())) Ok(SelfType::TryFromPyCell(ty.span()))
} }
} }