Skip to content

Commit 4806f01

Browse files
authored
Fix tidy errors and simplify example
1 parent 04fbec1 commit 4806f01

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

src/libstd/io/mod.rs

+6-8
Original file line numberDiff line numberDiff line change
@@ -145,16 +145,14 @@
145145
//! # }
146146
//! ```
147147
//!
148-
//! Note that you cannot use the `?` operator in functions that do not return a `Result<T, E>` (e.g. `main`).
149-
//! Instead, you can `match` on the return value to catch any possible errors:
150-
//!
148+
//! Note that you cannot use the `?` operator in functions that do not return
149+
//! a `Result<T, E>` (e.g. `main`). Instead, you can call `.unwrap()` or `match`
150+
//! on the return value to catch any possible errors:
151+
//!
151152
//! ```
152153
//! let mut input = String::new();
153-
//!
154-
//! match io::stdin().read_line(&mut input) {
155-
//! Err(why) => panic!("Failed to read input: {}", why.description()),
156-
//! Ok(_) => println!("You typed: {}", input.trim()),
157-
//! }
154+
//!
155+
//! io::stdin().read_line(&mut input).unwrap();
158156
//! ```
159157
//!
160158
//! And a very common source of output is standard output:

0 commit comments

Comments
 (0)