From 4168e026b41e27f471709529bf29a80f6c602adb Mon Sep 17 00:00:00 2001 From: Florian Hartwig Date: Sun, 1 Nov 2015 20:41:23 +0100 Subject: [PATCH] Stop using ok().expect() in Result docs --- src/libcore/result.rs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/libcore/result.rs b/src/libcore/result.rs index e48252fa6f62a..ee3bfacd731c3 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: