-
Notifications
You must be signed in to change notification settings - Fork 13.1k
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
book: fix mistake (File::open -> File::create) #36374
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. |
Thank you! Why is this a mistake, though? And if it is, then the error message needs to change as well. |
In this example, we are going to open the file and write it in the file. Open is read-only, so it needs to be changed to create to write. |
@@ -275,7 +275,7 @@ won’t have its methods: | |||
[write]: ../std/io/trait.Write.html | |||
|
|||
```rust,ignore | |||
let mut f = std::fs::File::open("foo.txt").expect("Couldn’t open foo.txt"); | |||
let mut f = std::fs::File::create("foo.txt").expect("Couldn’t open foo.txt"); |
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 think @steveklabnik is suggesting "Couldn’t open foo.txt"
should be changed to "Couldn’t create foo.txt"
Thank you! @frewsxcv |
@bors: r+ rollup ah ha! Since it is marked |
📌 Commit 5b59c14 has been approved by |
⌛ Testing commit 5b59c14 with merge 444b90c... |
💔 Test failed - auto-win-gnu-32-opt-rustbuild |
@bors: retry On Tue, Sep 13, 2016 at 8:39 PM, bors notifications@github.com wrote:
|
book: fix mistake (File::open -> File::create)
No description provided.