impl LateLintPass<'_> for UnnamedAddress {
fn check_expr(&mut self, cx: &LateContext<'_>, expr: &Expr<'_>) {
fn is_comparison(binop: BinOpKind) -> bool {
- match binop {
- BinOpKind::Eq | BinOpKind::Lt | BinOpKind::Le | BinOpKind::Ne | BinOpKind::Ge | BinOpKind::Gt => true,
- _ => false,
- }
+ matches!(
+ binop,
+ BinOpKind::Eq | BinOpKind::Lt | BinOpKind::Le | BinOpKind::Ne | BinOpKind::Ge | BinOpKind::Gt
+ )
}
fn is_trait_ptr(cx: &LateContext<'_>, expr: &Expr<'_>) -> bool {
}
fn is_fn_def(cx: &LateContext<'_>, expr: &Expr<'_>) -> bool {
- if let ty::FnDef(..) = cx.tables().expr_ty(expr).kind {
- true
- } else {
- false
- }
+ matches!(cx.tables().expr_ty(expr).kind, ty::FnDef(..))
}
if_chain! {