-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move
SelfAssignment
into Operators
lint pass
- Loading branch information
Showing
7 changed files
with
65 additions
and
69 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
use clippy_utils::diagnostics::span_lint; | ||
use clippy_utils::eq_expr_value; | ||
use clippy_utils::source::snippet; | ||
use rustc_hir::Expr; | ||
use rustc_lint::LateContext; | ||
|
||
use super::SELF_ASSIGNMENT; | ||
|
||
pub(super) fn check<'tcx>(cx: &LateContext<'tcx>, e: &'tcx Expr<'_>, lhs: &'tcx Expr<'_>, rhs: &'tcx Expr<'_>) { | ||
if eq_expr_value(cx, lhs, rhs) { | ||
let lhs = snippet(cx, lhs.span, "<lhs>"); | ||
let rhs = snippet(cx, rhs.span, "<rhs>"); | ||
span_lint( | ||
cx, | ||
SELF_ASSIGNMENT, | ||
e.span, | ||
&format!("self-assignment of `{}` to `{}`", rhs, lhs), | ||
); | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.