]> git.lizzy.rs Git - rust.git/blobdiff - src/tools/clippy/clippy_lints/src/manual_rem_euclid.rs
Rollup merge of #101266 - LuisCardosoOliveira:translation-rustcsession-pt3, r=davidtwco
[rust.git] / src / tools / clippy / clippy_lints / src / manual_rem_euclid.rs
index 2ce9d0e77c1fd167f093fd0cb2613bfaf9bab27b..95cc6bdbd8ba7bf0b748b7d9559bb9dc7e8af8f2 100644 (file)
@@ -71,7 +71,8 @@ fn check_expr(&mut self, cx: &LateContext<'tcx>, expr: &'tcx Expr<'_>) {
             && let Some(const3) = check_for_unsigned_int_constant(cx, right)
             // Also ensures the const is nonzero since zero can't be a divisor
             && const1 == const2 && const2 == const3
-            && let Some(hir_id) = path_to_local(expr3) {
+            && let Some(hir_id) = path_to_local(expr3)
+            && let Some(Node::Pat(_)) = cx.tcx.hir().find(hir_id) {
                 // Apply only to params or locals with annotated types
                 match cx.tcx.hir().find(cx.tcx.hir().get_parent_node(hir_id)) {
                     Some(Node::Param(..)) => (),