Fix tidy errors and simplify example

This commit is contained in:
Nick Sweeting 2017-03-27 16:34:13 -04:00 committed by GitHub
parent 04fbec1a0c
commit 4806f01d7c

View file

@ -145,16 +145,14 @@
//! # } //! # }
//! ``` //! ```
//! //!
//! Note that you cannot use the `?` operator in functions that do not return a `Result<T, E>` (e.g. `main`). //! Note that you cannot use the `?` operator in functions that do not return
//! Instead, you can `match` on the return value to catch any possible errors: //! 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(); //! let mut input = String::new();
//! //!
//! match io::stdin().read_line(&mut input) { //! io::stdin().read_line(&mut input).unwrap();
//! Err(why) => panic!("Failed to read input: {}", why.description()),
//! Ok(_) => println!("You typed: {}", input.trim()),
//! }
//! ``` //! ```
//! //!
//! And a very common source of output is standard output: //! And a very common source of output is standard output: