Closed
Description
fn main() {
let a = String::from("hello");
print(a);
}
fn print(input: &str) {
println!("{}", input);
}
error[E0308]: mismatched types
--> src/main.rs:3:11
|
3 | print(a);
| ^
| |
| expected &str, found struct `std::string::String`
| help: consider borrowing here: `&a`
|
= note: expected type `&str`
found type `std::string::String`
error: aborting due to previous error
The correct fix is already suggested, it would be great if cargo fix could apply that to the codebase.
cargo 1.29.0-nightly (2cd36b4ed 2018-07-25)
Metadata
Metadata
Assignees
Labels
No labels