From deee2680155a2b5c36d61fedb28d3aaf4ec1da40 Mon Sep 17 00:00:00 2001 From: Jake Hickey Date: Mon, 22 Jun 2015 18:38:19 -0400 Subject: [PATCH] Use a more descriptive variable name. 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. --- src/doc/trpl/error-handling.md | 6 +++--- 1 file 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