about summary refs log tree commit diff
diff options
context:
space:
mode:
authorFlorian Hartwig <florian.j.hartwig@gmail.com>2015-11-01 20:41:23 +0100
committerFlorian Hartwig <florian.j.hartwig@gmail.com>2015-11-01 20:41:23 +0100
commit4168e026b41e27f471709529bf29a80f6c602adb (patch)
tree951211a6514e8ae27230dfa11679e732f2f96338
parentf7a61678e3f245dcb0cb130769d3d924927505c4 (diff)
downloadrust-4168e026b41e27f471709529bf29a80f6c602adb.tar.gz
rust-4168e026b41e27f471709529bf29a80f6c602adb.zip
Stop using ok().expect() in Result docs
-rw-r--r--src/libcore/result.rs7
1 files changed, 3 insertions, 4 deletions
diff --git a/src/libcore/result.rs b/src/libcore/result.rs
index e48252fa6f6..ee3bfacd731 100644
--- a/src/libcore/result.rs
+++ b/src/libcore/result.rs
@@ -117,16 +117,15 @@
 //! warning (by default, controlled by the `unused_must_use` lint).
 //!
 //! You might instead, if you don't want to handle the error, simply
-//! panic, by converting to an `Option` with `ok`, then asserting
-//! success with `expect`. This will panic if the write fails, proving
-//! a marginally useful message indicating why:
+//! assert success with `expect`. This will panic if the
+//! write fails, providing a marginally useful message indicating why:
 //!
 //! ```{.no_run}
 //! use std::fs::File;
 //! use std::io::prelude::*;
 //!
 //! let mut file = File::create("valuable_data.txt").unwrap();
-//! file.write_all(b"important message").ok().expect("failed to write message");
+//! file.write_all(b"important message").expect("failed to write message");
 //! ```
 //!
 //! You might also simply assert success: