diff options
| author | bors <bors@rust-lang.org> | 2015-06-23 08:18:14 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2015-06-23 08:18:14 +0000 |
| commit | 17450192d93542b981df1f046007ed781ecd0ec0 (patch) | |
| tree | 1ac747e3888d0eedb7947a2a7355b0070dfdc3c0 | |
| parent | e749f724b07121e965120f6974aa0b3fda888944 (diff) | |
| parent | deee2680155a2b5c36d61fedb28d3aaf4ec1da40 (diff) | |
| download | rust-17450192d93542b981df1f046007ed781ecd0ec0.tar.gz rust-17450192d93542b981df1f046007ed781ecd0ec0.zip | |
Auto merge of #26513 - shunyata:master, r=alexcrichton
I'm currently reading the rust book and this variable name tripped me up. Because it was called "input", I thought at first it might contain the line read by read_line(). This new variable name will be more instructive to rust beginners.
| -rw-r--r-- | src/doc/trpl/error-handling.md | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/doc/trpl/error-handling.md b/src/doc/trpl/error-handling.md index 2a0e8ed1643..580eaa6ca55 100644 --- a/src/doc/trpl/error-handling.md +++ b/src/doc/trpl/error-handling.md @@ -225,9 +225,9 @@ There's another way of doing this that's a bit nicer than `unwrap()`: ```rust,ignore let mut buffer = String::new(); -let input = io::stdin().read_line(&mut buffer) - .ok() - .expect("Failed to read line"); +let num_bytes_read = io::stdin().read_line(&mut buffer) + .ok() + .expect("Failed to read line"); ``` `ok()` converts the `Result` into an `Option`, and `expect()` does the same |
