Improve error messages

This commit is contained in:
Ryan Levick 2021-01-12 14:58:51 +01:00 committed by Ryan Levick
parent 316e9db0cf
commit 49f32e0c8e
2 changed files with 25 additions and 21 deletions

View file

@ -1,39 +1,35 @@
warning: call to `.clone()` on a reference in this situation does nothing
--> $DIR/noop-method-call.rs:24:32
--> $DIR/noop-method-call.rs:24:35
|
LL | let foo_clone: &Foo<u32> = foo.clone();
| ^^^^^^^^^^^ unnecessary method call
| ^^^^^^^^ unnecessary method call
|
= note: `#[warn(noop_method_call)]` on by default
= note: the type the method is being called on and the return type are functionally equivalent.
= note: therefore, the method call doesn't actually do anything and can be removed.
= note: the type `&Foo<u32>` which `clone` is being called on is the same as the type returned from `clone`, so the method call does not do anything and can be removed.
warning: call to `.deref()` on a reference in this situation does nothing
--> $DIR/noop-method-call.rs:31:39
--> $DIR/noop-method-call.rs:31:44
|
LL | let derefed: &DerefExample<u32> = deref.deref();
| ^^^^^^^^^^^^^ unnecessary method call
| ^^^^^^^^ unnecessary method call
|
= note: the type the method is being called on and the return type are functionally equivalent.
= note: therefore, the method call doesn't actually do anything and can be removed.
= note: the type `&&DerefExample<u32>` which `deref` is being called on is the same as the type returned from `deref`, so the method call does not do anything and can be removed.
warning: call to `.borrow()` on a reference in this situation does nothing
--> $DIR/noop-method-call.rs:38:31
--> $DIR/noop-method-call.rs:38:32
|
LL | let borrowed: &Foo<u32> = a.borrow();
| ^^^^^^^^^^ unnecessary method call
| ^^^^^^^^^ unnecessary method call
|
= note: the type the method is being called on and the return type are functionally equivalent.
= note: therefore, the method call doesn't actually do anything and can be removed.
= note: the type `&&Foo<u32>` which `borrow` is being called on is the same as the type returned from `borrow`, so the method call does not do anything and can be removed.
warning: call to `.clone()` on a reference in this situation does nothing
--> $DIR/noop-method-call.rs:47:5
--> $DIR/noop-method-call.rs:47:8
|
LL | foo.clone();
| ^^^^^^^^^^^ unnecessary method call
| ^^^^^^^^ unnecessary method call
|
= note: the type the method is being called on and the return type are functionally equivalent.
= note: therefore, the method call doesn't actually do anything and can be removed.
= note: the type `&Foo<u32>` which `clone` is being called on is the same as the type returned from `clone`, so the method call does not do anything and can be removed.
warning: 4 warnings emitted