/// **Why is this bad?** `if` is not guaranteed to be exhaustive and conditionals can get
/// repetitive
///
- /// **Known problems:** None.
+ /// **Known problems:** The match statement may be slower due to the compiler
+ /// not inlining the call to cmp. See issue #5354
///
/// **Example:**
/// ```rust,ignore
}
// Check that the type being compared implements `core::cmp::Ord`
- let ty = cx.tables().expr_ty(lhs1);
+ let ty = cx.typeck_results().expr_ty(lhs1);
let is_ord = get_trait_def_id(cx, &paths::ORD).map_or(false, |id| implements_trait(cx, ty, id, &[]));
if !is_ord {
}
fn kind_is_cmp(kind: BinOpKind) -> bool {
- match kind {
- BinOpKind::Lt | BinOpKind::Gt | BinOpKind::Eq => true,
- _ => false,
- }
+ matches!(kind, BinOpKind::Lt | BinOpKind::Gt | BinOpKind::Eq)
}