diff --git a/src/libcore/macros.rs b/src/libcore/macros.rs index 4bf5a6302bc..2929fc9057d 100644 --- a/src/libcore/macros.rs +++ b/src/libcore/macros.rs @@ -349,34 +349,22 @@ macro_rules! try { /// write!(&mut v, "s = {:?}", s).unwrap(); // uses io::Write::write_fmt /// assert_eq!(v, b"s = \"abc 123\""); /// ``` - -/// /// Note : This macro can be used in no_std setups as well -/// /// In a no_std setup you are responsible for the -/// /// implementation details of the components. - -/// ```rust -/// extern crate core; +/// Note : This macro can be used in no_std setups as well +/// In a no_std setup you are responsible for the +/// implementation details of the components. +/// ``` +/// # extern crate core; /// use core::fmt::Write; - -/// #[derive(Debug)] -/// struct Greetings<'a>{ -/// message : &'a str, +/// struct Example{ /// } - - -/// impl<'a> Write for Greetings<'a>{ +/// impl Write for Example{ /// fn write_str(&mut self, _s: &str) -> core::fmt::Result { /// unimplemented!(); /// } /// } - -/// fn main(){ -/// let mut m = Greetings{message: ""}; -/// write!(&mut m, "Hello World").expect("Not written"); -/// } +/// let mut m = Example{}; +/// write!(&mut m, "Hello World").expect("Not written"); /// ``` - - #[macro_export] #[stable(feature = "rust1", since = "1.0.0")] macro_rules! write { @@ -746,4 +734,4 @@ mod builtin { ($cond:expr,) => ({ /* compiler built-in */ }); ($cond:expr, $($arg:tt)+) => ({ /* compiler built-in */ }); } -} +} \ No newline at end of file