pub static NOOP_METHOD_CALL: &Lint
Expand description

The noop_method_call lint detects specific calls to noop methods such as a calling <&T as Clone>::clone where T: !Clone.

§Example

struct Foo;
let foo = &Foo;
let clone: &Foo = foo.clone();

{{produces}}

§Explanation

Some method calls are noops meaning that they do nothing. Usually such methods are the result of blanket implementations that happen to create some method invocations that end up not doing anything. For instance, Clone is implemented on all &T, but calling clone on a &T where T does not implement clone, actually doesn’t do anything as references are copy. This lint detects these calls and warns the user about them.