Skip to content

Commit ee2223f

Browse files
jschweemilio
authored andcommitted
Fix clippy: match expression looks like matches! macro
1 parent fb1fdc8 commit ee2223f

File tree

3 files changed

+7
-16
lines changed

3 files changed

+7
-16
lines changed

src/bindgen/cdecl.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,7 @@ enum CDeclarator {
3030

3131
impl CDeclarator {
3232
fn is_ptr(&self) -> bool {
33-
match self {
34-
CDeclarator::Ptr { .. } | CDeclarator::Func { .. } => true,
35-
_ => false,
36-
}
33+
matches!(self, CDeclarator::Ptr { .. } | CDeclarator::Func { .. })
3734
}
3835
}
3936

src/bindgen/ir/ty.rs

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -300,10 +300,7 @@ impl PrimitiveType {
300300
}
301301

302302
fn can_cmp_order(&self) -> bool {
303-
match *self {
304-
PrimitiveType::Bool => false,
305-
_ => true,
306-
}
303+
!matches!(*self, PrimitiveType::Bool)
307304
}
308305

309306
fn can_cmp_eq(&self) -> bool {
@@ -551,10 +548,7 @@ impl Type {
551548
pub fn is_primitive_or_ptr_primitive(&self) -> bool {
552549
match *self {
553550
Type::Primitive(..) => true,
554-
Type::Ptr { ref ty, .. } => match ty.as_ref() {
555-
Type::Primitive(..) => true,
556-
_ => false,
557-
},
551+
Type::Ptr { ref ty, .. } => matches!(ty.as_ref(), Type::Primitive(..)),
558552
_ => false,
559553
}
560554
}

src/bindgen/parser.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -515,10 +515,10 @@ impl Parse {
515515
self.load_syn_ty(crate_name, mod_cfg, item);
516516
}
517517
syn::Item::Impl(ref item_impl) => {
518-
let has_assoc_const = item_impl.items.iter().any(|item| match item {
519-
syn::ImplItem::Const(_) => true,
520-
_ => false,
521-
});
518+
let has_assoc_const = item_impl
519+
.items
520+
.iter()
521+
.any(|item| matches!(item, syn::ImplItem::Const(_)));
522522
if has_assoc_const {
523523
impls_with_assoc_consts.push(item_impl);
524524
}

0 commit comments

Comments
 (0)