Skip to content

Commit 97a14ca

Browse files
Update clippy_lints/src/non_canonical_impls.rs
Co-authored-by: Samuel Tardieu <[email protected]>
1 parent 3359892 commit 97a14ca

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

clippy_lints/src/non_canonical_impls.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -293,10 +293,11 @@ fn self_cmp_call<'tcx>(
293293
ExprKind::Call(path, [_, _]) => path_res(cx, path)
294294
.opt_def_id()
295295
.is_some_and(|def_id| cx.tcx.is_diagnostic_item(sym::ord_cmp_method, def_id)),
296-
ExprKind::MethodCall(_, _, [other], ..) => {
297-
if let ExprKind::Path(path) = other.kind
298-
&& last_path_segment(&path).ident.name == kw::SelfLower
299-
{
296+
ExprKind::MethodCall(_, recv, [_], ..) => {
297+
let ExprKind::Path(path) = recv.kind else {
298+
return false;
299+
};
300+
if last_path_segment(&path).ident.name != kw::SelfLower {
300301
return false;
301302
}
302303

0 commit comments

Comments
 (0)