File tree 1 file changed +19
-4
lines changed
1 file changed +19
-4
lines changed Original file line number Diff line number Diff line change @@ -16,7 +16,6 @@ declare_lint! {
16
16
///
17
17
/// ```rust
18
18
/// # #![allow(unused)]
19
- /// #![warn(noop_method_call)]
20
19
/// struct Foo;
21
20
/// let foo = &Foo;
22
21
/// let clone: &Foo = foo.clone();
@@ -37,9 +36,25 @@ declare_lint! {
37
36
}
38
37
39
38
declare_lint ! {
40
- /// The `suspicious_double_ref_op` lint checks for usage of `.clone()` on an `&&T`,
41
- /// which copies the inner `&T`, instead of cloning the underlying `T` and
42
- /// can be confusing.
39
+ /// The `suspicious_double_ref_op` lint checks for usage of `.clone()`/`.borrow()`/`.deref()`
40
+ /// on an `&&T` when `T: !Deref/Borrow/Clone`, which means the call will copy the inner `&T`,
41
+ /// instead of performing the operation on the underlying `T` and can be confusing.
42
+ ///
43
+ /// ### Example
44
+ ///
45
+ /// ```rust
46
+ /// # #![allow(unused)]
47
+ /// struct Foo;
48
+ /// let foo = &&Foo;
49
+ /// let clone: &Foo = foo.clone();
50
+ /// ```
51
+ ///
52
+ /// {{produces}}
53
+ ///
54
+ /// ### Explanation
55
+ ///
56
+ /// Since `Foo` doesn't implement `Clone`, running `.clone()` only dereferences the double
57
+ /// reference, instead of cloning the inner type which should be what was intended.
43
58
pub SUSPICIOUS_DOUBLE_REF_OP ,
44
59
Warn ,
45
60
"using `clone` on `&&T`"
You can’t perform that action at this time.
0 commit comments