Skip to content

fix: allow fixing of trivial errors #5853

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
matthiaskrgr opened this issue Aug 2, 2018 · 2 comments
Closed

fix: allow fixing of trivial errors #5853

matthiaskrgr opened this issue Aug 2, 2018 · 2 comments

Comments

@matthiaskrgr
Copy link
Member

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)
@dwijnand
Copy link
Member

dwijnand commented Aug 2, 2018

Duplicate of #5846

@alexcrichton
Copy link
Member

Indeed!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants