about summary refs log tree commit diff
diff options
context:
space:
mode:
authorAndre Bogus <bogusandre@gmail.com>2019-06-20 14:36:53 +0200
committerAndre Bogus <bogusandre@gmail.com>2019-07-03 17:54:58 +0200
commitee05fc8104e5e2fecf8f67fc3d4259d5d576a20f (patch)
tree2dac5391e312ef82fb255fb963a8b584bd80e1a9
parent4fb77a0398d0339f35f1b18595b375428babd431 (diff)
downloadrust-ee05fc8104e5e2fecf8f67fc3d4259d5d576a20f.tar.gz
rust-ee05fc8104e5e2fecf8f67fc3d4259d5d576a20f.zip
First question mark in doctest
-rw-r--r--src/libcore/macros.rs11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/libcore/macros.rs b/src/libcore/macros.rs
index 8b44025f91f..4648f1a006e 100644
--- a/src/libcore/macros.rs
+++ b/src/libcore/macros.rs
@@ -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