about summary refs log tree commit diff
path: root/library/std/src
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2022-03-16 04:05:35 +0000
committerbors <bors@rust-lang.org>2022-03-16 04:05:35 +0000
commita2af9cf1cf6ccb195eae40cdd793939bc77e7e73 (patch)
tree85776d35bca2bd513ce46e8c0ad1c7c7d17f5588 /library/std/src
parentaf446e1d7086d4aeed495f6b03e70009e9424ce4 (diff)
parentaaf2255379c22f93e53c5fad14453ac7a791ae9e (diff)
downloadrust-a2af9cf1cf6ccb195eae40cdd793939bc77e7e73.tar.gz
rust-a2af9cf1cf6ccb195eae40cdd793939bc77e7e73.zip
Auto merge of #94987 - Dylan-DPC:rollup-5tssuhi, r=Dylan-DPC
Rollup of 5 pull requests

Successful merges:

 - #94868 (Format core and std macro rules, removing needless surrounding blocks)
 - #94951 (Extend the irrefutable_let_patterns lint to let chains)
 - #94955 (Refactor: Use `format_args_capture` in some parts of `rustc_parse`)
 - #94957 (Improve the explanation about the behaviour of read_line)
 - #94974 (Ensure that `let_else` does not interact with `let_chains`)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
Diffstat (limited to 'library/std/src')
-rw-r--r--library/std/src/io/mod.rs3
-rw-r--r--library/std/src/macros.rs28
2 files changed, 20 insertions, 11 deletions
diff --git a/library/std/src/io/mod.rs b/library/std/src/io/mod.rs
index 6005270a75f..cd2197fca35 100644
--- a/library/std/src/io/mod.rs
+++ b/library/std/src/io/mod.rs
@@ -2110,7 +2110,8 @@ pub trait BufRead: Read {
     }
 
     /// Read all bytes until a newline (the `0xA` byte) is reached, and append
-    /// them to the provided buffer.
+    /// them to the provided buffer. You do not need to clear the buffer before
+    /// appending.
     ///
     /// This function will read bytes from the underlying stream until the
     /// newline delimiter (the `0xA` byte) or EOF is found. Once found, all bytes
diff --git a/library/std/src/macros.rs b/library/std/src/macros.rs
index 23cbfaeef48..c597fb5df45 100644
--- a/library/std/src/macros.rs
+++ b/library/std/src/macros.rs
@@ -60,7 +60,9 @@ macro_rules! panic {
 #[cfg_attr(not(test), rustc_diagnostic_item = "print_macro")]
 #[allow_internal_unstable(print_internals)]
 macro_rules! print {
-    ($($arg:tt)*) => ($crate::io::_print($crate::format_args!($($arg)*)));
+    ($($arg:tt)*) => {
+        $crate::io::_print($crate::format_args!($($arg)*))
+    };
 }
 
 /// Prints to the standard output, with a newline.
@@ -94,10 +96,12 @@ macro_rules! print {
 #[cfg_attr(not(test), rustc_diagnostic_item = "println_macro")]
 #[allow_internal_unstable(print_internals, format_args_nl)]
 macro_rules! println {
-    () => ($crate::print!("\n"));
-    ($($arg:tt)*) => ({
-        $crate::io::_print($crate::format_args_nl!($($arg)*));
-    })
+    () => {
+        $crate::print!("\n")
+    };
+    ($($arg:tt)*) => {
+        $crate::io::_print($crate::format_args_nl!($($arg)*))
+    };
 }
 
 /// Prints to the standard error.
@@ -126,7 +130,9 @@ macro_rules! println {
 #[cfg_attr(not(test), rustc_diagnostic_item = "eprint_macro")]
 #[allow_internal_unstable(print_internals)]
 macro_rules! eprint {
-    ($($arg:tt)*) => ($crate::io::_eprint($crate::format_args!($($arg)*)));
+    ($($arg:tt)*) => {
+        $crate::io::_eprint($crate::format_args!($($arg)*))
+    };
 }
 
 /// Prints to the standard error, with a newline.
@@ -155,10 +161,12 @@ macro_rules! eprint {
 #[cfg_attr(not(test), rustc_diagnostic_item = "eprintln_macro")]
 #[allow_internal_unstable(print_internals, format_args_nl)]
 macro_rules! eprintln {
-    () => ($crate::eprint!("\n"));
-    ($($arg:tt)*) => ({
-        $crate::io::_eprint($crate::format_args_nl!($($arg)*));
-    })
+    () => {
+        $crate::eprint!("\n")
+    };
+    ($($arg:tt)*) => {
+        $crate::io::_eprint($crate::format_args_nl!($($arg)*))
+    };
 }
 
 /// Prints and returns the value of a given expression for quick and dirty