From af6c871fa1e32edb9767226aa13b09c60e3aeda5 Mon Sep 17 00:00:00 2001 From: Tshepang Lekhonkhobe Date: Sat, 13 Oct 2018 19:28:18 +0200 Subject: doc: make core::fmt::Error example more simple --- src/libcore/fmt/mod.rs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'src/libcore') diff --git a/src/libcore/fmt/mod.rs b/src/libcore/fmt/mod.rs index bd253e69db3..75ec0d7d50b 100644 --- a/src/libcore/fmt/mod.rs +++ b/src/libcore/fmt/mod.rs @@ -96,9 +96,8 @@ pub type Result = result::Result<(), Error>; /// use std::fmt::{self, write}; /// /// let mut output = String::new(); -/// match write(&mut output, format_args!("Hello {}!", "world")) { -/// Err(fmt::Error) => panic!("An error occurred"), -/// _ => (), +/// if let Err(fmt::Error) = write(&mut output, format_args!("Hello {}!", "world")) { +/// panic!("An error occurred"); /// } /// ``` #[stable(feature = "rust1", since = "1.0.0")] -- cgit 1.4.1-3-g733a5