]> git.lizzy.rs Git - rust.git/commitdiff
First question mark in doctest
authorAndre Bogus <bogusandre@gmail.com>
Thu, 20 Jun 2019 12:36:53 +0000 (14:36 +0200)
committerAndre Bogus <bogusandre@gmail.com>
Wed, 3 Jul 2019 15:54:58 +0000 (17:54 +0200)
src/libcore/macros.rs

index 8b44025f91f5e710f88141df83c262f13661c3af..4648f1a006eca7113e37ab6a379bab27cff9d40e 100644 (file)
@@ -335,11 +335,14 @@ macro_rules! r#try {
 /// ```
 /// use std::io::Write;
 ///
-/// let mut w = Vec::new();
-/// write!(&mut w, "test").unwrap();
-/// write!(&mut w, "formatted {}", "arguments").unwrap();
+/// fn main() -> std::io::Result<()> {
+///     let mut w = Vec::new();
+///     write!(&mut w, "test")?;
+///     write!(&mut w, "formatted {}", "arguments")?;
 ///
-/// assert_eq!(w, b"testformatted arguments");
+///     assert_eq!(w, b"testformatted arguments");
+///     Ok(())
+/// }
 /// ```
 ///
 /// A module can import both `std::fmt::Write` and `std::io::Write` and call `write!` on objects