Skip to content

Commit

Permalink
Rollup merge of #131503 - theemathas:stdin_read_line_docs, r=Mark-Sim…
Browse files Browse the repository at this point in the history
…ulacrum

More clearly document Stdin::read_line

These are common pitfalls for beginners, so I think it's worth making the subtleties more visible.
  • Loading branch information
matthiaskrgr authored Oct 12, 2024
2 parents d547f2c + 2035737 commit c0f1682
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion library/std/src/io/stdio.rs
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,12 @@ impl Stdin {
/// Locks this handle and reads a line of input, appending it to the specified buffer.
///
/// For detailed semantics of this method, see the documentation on
/// [`BufRead::read_line`].
/// [`BufRead::read_line`]. In particular:
/// * Previous content of the buffer will be preserved. To avoid appending
/// to the buffer, you need to [`clear`] it first.
/// * The trailing newline character, if any, is included in the buffer.
///
/// [`clear`]: String::clear
///
/// # Examples
///
Expand Down

0 comments on commit c0f1682

Please sign in to comment.