-
Notifications
You must be signed in to change notification settings - Fork 12.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
67 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,3 @@ | ||
#![cfg_attr(not(bootstrap), allow(noop_method_call))] | ||
|
||
#[test] | ||
fn test_borrowed_clone() { | ||
let x = 5; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,6 @@ | ||
// run-pass | ||
// pretty-expanded FIXME #23616 | ||
|
||
#![allow(noop_method_call)] | ||
|
||
struct NoClone; | ||
|
||
fn main() { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,39 @@ | ||
warning: call to `.clone()` on a reference in this situation does nothing | ||
--> $DIR/noop-method-call.rs:12:74 | ||
--> $DIR/noop-method-call.rs:16:71 | ||
| | ||
LL | let non_clone_type_ref_clone: &NonCloneType<u32> = non_clone_type_ref.clone(); | ||
| ^^^^^^^^ unnecessary method call | ||
LL | let non_clone_type_ref_clone: &PlainType<u32> = non_clone_type_ref.clone(); | ||
| ^^^^^^^^ unnecessary method call | ||
| | ||
= note: `#[warn(noop_method_call)]` on by default | ||
= note: the type `&NonCloneType<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 | ||
note: the lint level is defined here | ||
--> $DIR/noop-method-call.rs:4:9 | ||
| | ||
LL | #![warn(noop_method_call)] | ||
| ^^^^^^^^^^^^^^^^ | ||
= note: the type `&PlainType<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:28:63 | ||
| | ||
LL | let non_deref_type_deref: &PlainType<u32> = non_deref_type.deref(); | ||
| ^^^^^^^^ unnecessary method call | ||
| | ||
= note: the type `&PlainType<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:36:66 | ||
| | ||
LL | let non_borrow_type_borrow: &PlainType<u32> = non_borrow_type.borrow(); | ||
| ^^^^^^^^^ unnecessary method call | ||
| | ||
= note: the type `&PlainType<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:32:19 | ||
--> $DIR/noop-method-call.rs:52:19 | ||
| | ||
LL | non_clone_type.clone(); | ||
| ^^^^^^^^ unnecessary method call | ||
| | ||
= note: the type `&NonCloneType<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 | ||
= note: the type `&PlainType<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: 2 warnings emitted | ||
warning: 4 warnings emitted | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,6 +14,5 @@ mod y { | |
|
||
pub fn main() { | ||
use x::*; | ||
#[allow(noop_method_call)] | ||
(&0).deref(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters