File tree Expand file tree Collapse file tree 2 files changed +6
-2
lines changed Expand file tree Collapse file tree 2 files changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -404,10 +404,11 @@ macro_rules! write {
404404/// use std::io::Write;
405405///
406406/// let mut w = Vec::new();
407+ /// writeln!(&mut w).unwrap();
407408/// writeln!(&mut w, "test").unwrap();
408409/// writeln!(&mut w, "formatted {}", "arguments").unwrap();
409410///
410- /// assert_eq!(&w[..], "test \nformatted arguments\n".as_bytes());
411+ /// assert_eq!(&w[..], "\ntest \nformatted arguments\n".as_bytes());
411412/// ```
412413///
413414/// A module can import both `std::fmt::Write` and `std::io::Write` and call `write!` on objects
@@ -427,6 +428,9 @@ macro_rules! write {
427428#[ macro_export]
428429#[ stable( feature = "rust1" , since = "1.0.0" ) ]
429430macro_rules! writeln {
431+ ( $dst: expr) => (
432+ write!( $dst, "\n " )
433+ ) ;
430434 ( $dst: expr, $fmt: expr) => (
431435 write!( $dst, concat!( $fmt, "\n " ) )
432436 ) ;
Original file line number Diff line number Diff line change @@ -112,7 +112,7 @@ macro_rules! print {
112112/// # Examples
113113///
114114/// ```
115- /// println!();
115+ /// println!(); // prints just a newline
116116/// println!("hello there!");
117117/// println!("format {} arguments", "some");
118118/// ```
You can’t perform that action at this time.
0 commit comments