diff options
| author | Guillaume Gomez <guillaume1.gomez@gmail.com> | 2016-09-14 17:15:37 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2016-09-14 17:15:37 +0200 |
| commit | 4476b7b43b2826b6f0e71f4638159f8718c0a440 (patch) | |
| tree | c673a4ee6e4e6ae3c8ff15768556c7f68429abfd | |
| parent | 99c2f72814f3e3ab276b133cf18430a74e839f75 (diff) | |
| parent | 5b59c141438f10f7351992f1ff38c20e63a9a441 (diff) | |
| download | rust-4476b7b43b2826b6f0e71f4638159f8718c0a440.tar.gz rust-4476b7b43b2826b6f0e71f4638159f8718c0a440.zip | |
Rollup merge of #36374 - dangcheng:patch-1, r=steveklabnik
book: fix mistake (File::open -> File::create)
| -rw-r--r-- | src/doc/book/traits.md | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/doc/book/traits.md b/src/doc/book/traits.md index 9cbb514e280..d07fb6b7c45 100644 --- a/src/doc/book/traits.md +++ b/src/doc/book/traits.md @@ -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 create foo.txt"); let buf = b"whatever"; // byte string literal. buf: &[u8; 8] let result = f.write(buf); # result.unwrap(); // ignore the error @@ -294,7 +294,7 @@ We need to `use` the `Write` trait first: ```rust,ignore use std::io::Write; -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 create foo.txt"); let buf = b"whatever"; let result = f.write(buf); # result.unwrap(); // ignore the error |
