Skip to content

Commit 3909223

Browse files
committed
Fix noop_method_call detection for new diagnostic items
1 parent 92009f2 commit 3909223

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

compiler/rustc_lint/src/noop_method_call.rs

+6-1
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,12 @@ impl<'tcx> LateLintPass<'tcx> for NoopMethodCall {
114114

115115
let orig_ty = expr_ty.peel_refs();
116116

117-
if receiver_ty == expr_ty {
117+
if receiver_ty == expr_ty
118+
&& matches!(
119+
name,
120+
sym::noop_method_borrow | sym::noop_method_clone | sym::noop_method_deref
121+
)
122+
{
118123
cx.emit_spanned_lint(
119124
NOOP_METHOD_CALL,
120125
span,

0 commit comments

Comments
 (0)