Closed
Description
On type mismatch with a suggestion to borrow in order to dereference a String
into a &str
, we should notice unnecessary .clone()
calls:
error[E0308]: mismatched types
--> src/main.rs:7:38
|
7 | assert_eq!(make_lipographic('e', passage.clone()), passage);
| ^^^^^^^^^^^^^^^
| |
| expected &str, found struct `std::string::String`
| help: consider borrowing here: `&passage.clone()`
|
= note: expected type `&str`
found type `std::string::String`
and suggest their removal:
error[E0308]: mismatched types
--> src/main.rs:7:38
|
7 | assert_eq!(make_lipographic('e', passage.clone()), passage);
| ^^^^^^^^^^^^^^^
| |
| expected &str, found struct `std::string::String`
| help: consider borrowing and avoiding the clone here: `&passage`
|
= note: expected type `&str`
found type `std::string::String`
Activity
Rebuffing the Attack of the `clone`
Rollup merge of rust-lang#61143 - estebank:issue-61106, r=eddyb
Rollup merge of rust-lang#61143 - estebank:issue-61106, r=eddyb
Auto merge of #61143 - estebank:issue-61106, r=eddyb