summary refs log tree commit diff
path: root/src/libstd
diff options
context:
space:
mode:
authorNick Sweeting <git@nicksweeting.com>2017-03-27 16:34:13 -0400
committerGitHub <noreply@github.com>2017-03-27 16:34:13 -0400
commit4806f01d7c1f35a1b6f675ff099b86ec6e6c1540 (patch)
treedda45b0879739bb94fbef303b48ec72ba0de5e1c /src/libstd
parent04fbec1a0cb7467834bd264b80350b1cade8b4ca (diff)
downloadrust-4806f01d7c1f35a1b6f675ff099b86ec6e6c1540.tar.gz
rust-4806f01d7c1f35a1b6f675ff099b86ec6e6c1540.zip
Fix tidy errors and simplify example
Diffstat (limited to 'src/libstd')
-rw-r--r--src/libstd/io/mod.rs14
1 files changed, 6 insertions, 8 deletions
diff --git a/src/libstd/io/mod.rs b/src/libstd/io/mod.rs
index 773b0964b42..1b0c992ba09 100644
--- a/src/libstd/io/mod.rs
+++ b/src/libstd/io/mod.rs
@@ -145,16 +145,14 @@
 //! # }
 //! ```
 //!
-//! Note that you cannot use the `?` operator in functions that do not return a `Result<T, E>` (e.g. `main`).
-//! Instead, you can `match` on the return value to catch any possible errors:
-//! 
+//! Note that you cannot use the `?` operator in functions that do not return
+//! a `Result<T, E>` (e.g. `main`). Instead, you can call `.unwrap()` or `match`
+//! on the return value to catch any possible errors:
+//!
 //! ```
 //! let mut input = String::new();
-//! 
-//! match io::stdin().read_line(&mut input) {
-//!     Err(why) => panic!("Failed to read input: {}", why.description()),
-//!     Ok(_) => println!("You typed: {}", input.trim()),
-//! }
+//!
+//! io::stdin().read_line(&mut input).unwrap();
 //! ```
 //!
 //! And a very common source of output is standard output: