Skip to content

Commit 72fb8f3

Browse files
committed
Fix example for BufferedReader
Fixes rust-lang#18197
1 parent e2cd459 commit 72fb8f3

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

src/libstd/io/buffered.rs

+3-4
Original file line numberDiff line numberDiff line change
@@ -130,14 +130,13 @@ impl<R: Reader> Reader for BufferedReader<R> {
130130
/// # Example
131131
///
132132
/// ```rust
133-
/// # #![allow(unused_must_use)]
134133
/// use std::io::{BufferedWriter, File};
135134
///
136-
/// let file = File::open(&Path::new("message.txt"));
135+
/// let file = File::create(&Path::new("message.txt")).unwrap();
137136
/// let mut writer = BufferedWriter::new(file);
138137
///
139-
/// writer.write_str("hello, world");
140-
/// writer.flush();
138+
/// writer.write_str("hello, world").unwrap();
139+
/// writer.flush().unwrap();
141140
/// ```
142141
pub struct BufferedWriter<W> {
143142
inner: Option<W>,

0 commit comments

Comments
 (0)