Description
Code
I am learning Rust, and I keep typing std::io::stdin().get_line()
instead of std::io::stdin().read_line()
and the compiler doesn't give any useful hints.
Current output
Compiling playground v0.0.1 (/playground)
error[E0599]: no method named `get_line` found for struct `Stdin` in the current scope
--> src/main.rs:5:13
|
5 | stdin().get_line(&mut string);
| ^^^^^^^^ method not found in `Stdin`
Desired output
Compiling playground v0.0.1 (/playground)
error[E0599]: no method named `get_line` found for struct `Stdin` in the current scope
--> src/main.rs:5:13
|
5 | stdin().get_line(&mut string);
| ^^^^^^^^
|
help: there is a method `read_line` with a similar name
|
5 | stdin().read_line(&mut string);
| ~~~~~~~~~
Rationale and extra context
I keep accidentally making this mistake because I am a beginner.
Other cases
No response
Rust Version
rustc version 1.81.0 via https://play.rust-lang.org/?version=stable&mode=debug&edition=2021
I am not able to access my laptop right now, and it uses 1.80.1 anyway.
Anything else?
No response
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment