-use crate::utils::eq_expr_value;
use clippy_utils::diagnostics::span_lint;
+use clippy_utils::eq_expr_value;
use clippy_utils::source::snippet;
use rustc_hir::{Expr, ExprKind};
use rustc_lint::{LateContext, LateLintPass};
use rustc_session::{declare_lint_pass, declare_tool_lint};
declare_clippy_lint! {
- /// **What it does:** Checks for explicit self-assignments.
+ /// ### What it does
+ /// Checks for explicit self-assignments.
///
- /// **Why is this bad?** Self-assignments are redundant and unlikely to be
+ /// ### Why is this bad?
+ /// Self-assignments are redundant and unlikely to be
/// intentional.
///
- /// **Known problems:** If expression contains any deref coercions or
+ /// ### Known problems
+ /// If expression contains any deref coercions or
/// indexing operations they are assumed not to have any side effects.
///
- /// **Example:**
- ///
+ /// ### Example
/// ```rust
/// struct Event {
/// id: usize,
/// a.y = a.y;
/// }
/// ```
+ #[clippy::version = "1.48.0"]
pub SELF_ASSIGNMENT,
correctness,
"explicit self-assignment"