Skip to content

Commit dc87247

Browse files
authored
Rollup merge of rust-lang#55047 - tshepang:simple, r=alexcrichton
doc: make core::fmt::Error example more simple
2 parents 78765e5 + af6c871 commit dc87247

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

src/libcore/fmt/mod.rs

+2-3
Original file line numberDiff line numberDiff line change
@@ -96,9 +96,8 @@ pub type Result = result::Result<(), Error>;
9696
/// use std::fmt::{self, write};
9797
///
9898
/// let mut output = String::new();
99-
/// match write(&mut output, format_args!("Hello {}!", "world")) {
100-
/// Err(fmt::Error) => panic!("An error occurred"),
101-
/// _ => (),
99+
/// if let Err(fmt::Error) = write(&mut output, format_args!("Hello {}!", "world")) {
100+
/// panic!("An error occurred");
102101
/// }
103102
/// ```
104103
#[stable(feature = "rust1", since = "1.0.0")]

0 commit comments

Comments
 (0)