Skip to content

Commit 3ae6d06

Browse files
MagnumOpus21Siva Prasad
authored and
Siva Prasad
committed
Refined the example
1 parent 2ae2c62 commit 3ae6d06

File tree

1 file changed

+10
-22
lines changed

1 file changed

+10
-22
lines changed

src/libcore/macros.rs

+10-22
Original file line numberDiff line numberDiff line change
@@ -349,34 +349,22 @@ macro_rules! try {
349349
/// write!(&mut v, "s = {:?}", s).unwrap(); // uses io::Write::write_fmt
350350
/// assert_eq!(v, b"s = \"abc 123\"");
351351
/// ```
352-
353-
/// /// Note : This macro can be used in no_std setups as well
354-
/// /// In a no_std setup you are responsible for the
355-
/// /// implementation details of the components.
356-
357-
/// ```rust
358-
/// extern crate core;
352+
/// Note : This macro can be used in no_std setups as well
353+
/// In a no_std setup you are responsible for the
354+
/// implementation details of the components.
355+
/// ```
356+
/// # extern crate core;
359357
/// use core::fmt::Write;
360-
361-
/// #[derive(Debug)]
362-
/// struct Greetings<'a>{
363-
/// message : &'a str,
358+
/// struct Example{
364359
/// }
365-
366-
367-
/// impl<'a> Write for Greetings<'a>{
360+
/// impl Write for Example{
368361
/// fn write_str(&mut self, _s: &str) -> core::fmt::Result {
369362
/// unimplemented!();
370363
/// }
371364
/// }
372-
373-
/// fn main(){
374-
/// let mut m = Greetings{message: ""};
375-
/// write!(&mut m, "Hello World").expect("Not written");
376-
/// }
365+
/// let mut m = Example{};
366+
/// write!(&mut m, "Hello World").expect("Not written");
377367
/// ```
378-
379-
380368
#[macro_export]
381369
#[stable(feature = "rust1", since = "1.0.0")]
382370
macro_rules! write {
@@ -746,4 +734,4 @@ mod builtin {
746734
($cond:expr,) => ({ /* compiler built-in */ });
747735
($cond:expr, $($arg:tt)+) => ({ /* compiler built-in */ });
748736
}
749-
}
737+
}

0 commit comments

Comments
 (0)