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`