Commit 127699e 1 parent 92009f2 commit 127699e Copy full SHA for 127699e
File tree 2 files changed +18
-1
lines changed
2 files changed +18
-1
lines changed Original file line number Diff line number Diff line change @@ -114,7 +114,12 @@ impl<'tcx> LateLintPass<'tcx> for NoopMethodCall {
114
114
115
115
let orig_ty = expr_ty. peel_refs ( ) ;
116
116
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
+ {
118
123
cx. emit_spanned_lint (
119
124
NOOP_METHOD_CALL ,
120
125
span,
Original file line number Diff line number Diff line change @@ -49,3 +49,15 @@ fn non_generic(non_clone_type: &PlainType<u32>) {
49
49
non_clone_type. clone ( ) ;
50
50
//~^ WARN call to `.clone()` on a reference in this situation does nothing
51
51
}
52
+
53
+ struct DiagnosticClone ;
54
+ impl Clone for DiagnosticClone {
55
+ #[ rustc_diagnostic_item = "other_clone" ]
56
+ fn clone ( & self ) -> Self {
57
+ * self
58
+ }
59
+ }
60
+
61
+ fn with_other_diagnostic_item ( x : & DiagnosticClone ) {
62
+ x. clone ( ) ;
63
+ }
You can’t perform that action at this time.
0 commit comments