-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
BufReader Stdin or StdinLock #6755
Comments
Shouldn't |
Yes, I wrote it wrongly. I made the same mistake which the lint should solve. |
I think this should also include |
@camsteffen I don't think so as |
Ah you're right. |
@rustbot claim |
Hi @arya-k! Do you still plan to work on that? |
Hi! I don’t think I have the bandwidth unfortunately- feel free to take over.
|
Sounds good, I’ll claim it @rustbot claim |
Hi @CBenoit , are you still working on this issue? |
I completely forgot about it. Feel free to claim! |
What it does
Suggest using
StdinLock
rather thanBufReader::new(io::stdin())
since it is already buffered. We might also want to take care oflet stdin = io::stdin(); BufReader::new(stdin)
and alsoBufReader::new(stdinlock)
(there could be people doing this).Categories (optional)
Locking stdin also provide benefit for not having to re-lock it on every read.
Source https://users.rust-lang.org/t/correct-way-for-taking-large-input-from-keyboard/55304/11
Related to #1805
For example:
BufRead
Drawbacks
None.
Example
Could be written as:
The text was updated successfully, but these errors were encountered: