File tree 2 files changed +6
-2
lines changed
2 files changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -404,10 +404,11 @@ macro_rules! write {
404
404
/// use std::io::Write;
405
405
///
406
406
/// let mut w = Vec::new();
407
+ /// writeln!(&mut w).unwrap();
407
408
/// writeln!(&mut w, "test").unwrap();
408
409
/// writeln!(&mut w, "formatted {}", "arguments").unwrap();
409
410
///
410
- /// assert_eq!(&w[..], "test \nformatted arguments\n".as_bytes());
411
+ /// assert_eq!(&w[..], "\ntest \nformatted arguments\n".as_bytes());
411
412
/// ```
412
413
///
413
414
/// A module can import both `std::fmt::Write` and `std::io::Write` and call `write!` on objects
@@ -427,6 +428,9 @@ macro_rules! write {
427
428
#[ macro_export]
428
429
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
429
430
macro_rules! writeln {
431
+ ( $dst: expr) => (
432
+ write!( $dst, "\n " )
433
+ ) ;
430
434
( $dst: expr, $fmt: expr) => (
431
435
write!( $dst, concat!( $fmt, "\n " ) )
432
436
) ;
Original file line number Diff line number Diff line change @@ -112,7 +112,7 @@ macro_rules! print {
112
112
/// # Examples
113
113
///
114
114
/// ```
115
- /// println!();
115
+ /// println!(); // prints just a newline
116
116
/// println!("hello there!");
117
117
/// println!("format {} arguments", "some");
118
118
/// ```
You can’t perform that action at this time.
0 commit comments