-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
std_misc/process/pipe: remove unnecessary enclosing block #704
Conversation
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @steveklabnik (or someone else) soon. If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes. Please see the contribution instructions for more information. |
// | ||
// This is very important, otherwise `wc` wouldn't start processing the | ||
// input we just sent. | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This block (5 lines above this) should probably be removed because it is related to the braces you just removed. It makes little sense without them.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I left it in (and rephrased it slightly) because it seemed important to mention that the implicit dropping causes ChildStdin to close. (If someone has a let mut stdin = process.stdin;
, the program will hang forever.)
Is the phrasing incorrect?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, I see. If it is important to emphasize that point, you should save it to a variable and include the braces which were just backed out to emphasize the dropping. IDK, I guess it might be nitpicky though. Not sure.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't object to putting the braces back and adding a let mut stdin =
to emphasize the dropping, if that's the Rust way of doing things.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe the wording is just odd. Can't think of anything better right now.
Any idea what w should do here? |
To summarize, it could be
But I really don't know what to do here because I don't know how this is written in real Rust programs. |
I think I vote #1, after sleeping on it. Thank you! |
std_misc/process/pipe: remove unnecessary enclosing block
I think you voted for number 2 since you merged it? |
.... yes. I am very, very jetlagged, hehe. merging was what I wanted to do. |
Fixes #702.
Thanks to mbrubeck and sfackler for helping me out with this.