1 use clippy_utils::diagnostics::span_lint;
2 use clippy_utils::eq_expr_value;
3 use clippy_utils::source::snippet;
5 use rustc_lint::LateContext;
7 use super::SELF_ASSIGNMENT;
9 pub(super) fn check<'tcx>(cx: &LateContext<'tcx>, e: &'tcx Expr<'_>, lhs: &'tcx Expr<'_>, rhs: &'tcx Expr<'_>) {
10 if eq_expr_value(cx, lhs, rhs) {
11 let lhs = snippet(cx, lhs.span, "<lhs>");
12 let rhs = snippet(cx, rhs.span, "<rhs>");
17 &format!("self-assignment of `{rhs}` to `{lhs}`"),