First question mark in doctest

This commit is contained in:
Andre Bogus 2019-06-20 14:36:53 +02:00
parent 4fb77a0398
commit ee05fc8104
1 changed files with 7 additions and 4 deletions

View 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