Skip to content

Commit 9198af6

Browse files
committed
Fix minor documentation issue. Code outside the test would fail. Seek documentation clearly states that negative indexes will cause error.
Just making the code in the example to return Result::Ok, instead of Result::Error.
1 parent 417b9b0 commit 9198af6

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

std/src/io/cursor.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,8 @@ use crate::io::{self, BorrowedCursor, ErrorKind, IoSlice, IoSliceMut, SeekFrom};
5151
/// // We might want to use a BufReader here for efficiency, but let's
5252
/// // keep this example focused.
5353
/// let mut file = File::create("foo.txt")?;
54+
/// // First, we need to allocate 10 bytes to be able to write into.
55+
/// file.set_len(10)?;
5456
///
5557
/// write_ten_bytes_at_end(&mut file)?;
5658
/// # Ok(())

0 commit comments

Comments
 (0)