Fix clippy: match expression looks like matches! macro

This commit is contained in:
Jonathan Schwender 2023-03-08 10:06:15 +01:00 committed by Emilio Cobos Álvarez
parent fb1fdc8aed
commit ee2223fa13
3 changed files with 7 additions and 16 deletions

View File

@ -30,10 +30,7 @@ enum CDeclarator {
impl CDeclarator {
fn is_ptr(&self) -> bool {
match self {
CDeclarator::Ptr { .. } | CDeclarator::Func { .. } => true,
_ => false,
}
matches!(self, CDeclarator::Ptr { .. } | CDeclarator::Func { .. })
}
}

View File

@ -300,10 +300,7 @@ impl PrimitiveType {
}
fn can_cmp_order(&self) -> bool {
match *self {
PrimitiveType::Bool => false,
_ => true,
}
!matches!(*self, PrimitiveType::Bool)
}
fn can_cmp_eq(&self) -> bool {
@ -551,10 +548,7 @@ impl Type {
pub fn is_primitive_or_ptr_primitive(&self) -> bool {
match *self {
Type::Primitive(..) => true,
Type::Ptr { ref ty, .. } => match ty.as_ref() {
Type::Primitive(..) => true,
_ => false,
},
Type::Ptr { ref ty, .. } => matches!(ty.as_ref(), Type::Primitive(..)),
_ => false,
}
}

View File

@ -515,10 +515,10 @@ impl Parse {
self.load_syn_ty(crate_name, mod_cfg, item);
}
syn::Item::Impl(ref item_impl) => {
let has_assoc_const = item_impl.items.iter().any(|item| match item {
syn::ImplItem::Const(_) => true,
_ => false,
});
let has_assoc_const = item_impl
.items
.iter()
.any(|item| matches!(item, syn::ImplItem::Const(_)));
if has_assoc_const {
impls_with_assoc_consts.push(item_impl);
}