/// ```rust
/// # let x = 1;
/// if x + 1 == x + 1 {}
- /// ```
- /// or
- /// ```rust
+ ///
+ /// // or
+ ///
/// # let a = 3;
/// # let b = 4;
/// assert_eq!(a, a);
/// ### Why is this bad?
/// It is more idiomatic to dereference the other argument.
///
- /// ### Known problems
- /// None
- ///
/// ### Example
- /// ```ignore
- /// // Bad
+ /// ```rust,ignore
/// &x == y
+ /// ```
///
- /// // Good
+ /// Use instead:
+ /// ```rust,ignore
/// x == *y
/// ```
#[clippy::version = "pre 1.29.0"]
declare_lint_pass!(EqOp => [EQ_OP, OP_REF]);
impl<'tcx> LateLintPass<'tcx> for EqOp {
- #[allow(clippy::similar_names, clippy::too_many_lines)]
+ #[expect(clippy::similar_names, clippy::too_many_lines)]
fn check_expr(&mut self, cx: &LateContext<'tcx>, e: &'tcx Expr<'_>) {
if_chain! {
if let Some((macro_call, macro_name)) = first_node_macro_backtrace(cx, e).find_map(|macro_call| {
},
};
if let Some(trait_id) = trait_id {
- #[allow(clippy::match_same_arms)]
match (&left.kind, &right.kind) {
// do not suggest to dereference literals
(&ExprKind::Lit(..), _) | (_, &ExprKind::Lit(..)) => {},