Use implicit capture syntax in format_args

This updates the standard library's documentation to use the new syntax. The
documentation is worthwhile to update as it should be more idiomatic
(particularly for features like this, which are nice for users to get acquainted
with). The general codebase is likely more hassle than benefit to update: it'll
hurt git blame, and generally updates can be done by folks updating the code if
(and when) that makes things more readable with the new format.

A few places in the compiler and library code are updated (mostly just due to
already having been done when this commit was first authored).
This commit is contained in:
T-O-R-U-S
2022-02-12 23:16:17 +04:00
committed by Mark Rousskov
parent ba14a836c7
commit 72a25d05bf
177 changed files with 724 additions and 734 deletions

View File

@@ -605,9 +605,9 @@ impl UdpSocket {
///
/// let socket = UdpSocket::bind("127.0.0.1:34254").expect("couldn't bind to address");
/// match socket.take_error() {
/// Ok(Some(error)) => println!("UdpSocket error: {:?}", error),
/// Ok(Some(error)) => println!("UdpSocket error: {error:?}"),
/// Ok(None) => println!("No error"),
/// Err(error) => println!("UdpSocket.take_error failed: {:?}", error),
/// Err(error) => println!("UdpSocket.take_error failed: {error:?}"),
/// }
/// ```
#[stable(feature = "net2_mutators", since = "1.9.0")]
@@ -686,8 +686,8 @@ impl UdpSocket {
/// socket.connect("127.0.0.1:8080").expect("connect function failed");
/// let mut buf = [0; 10];
/// match socket.recv(&mut buf) {
/// Ok(received) => println!("received {} bytes {:?}", received, &buf[..received]),
/// Err(e) => println!("recv function failed: {:?}", e),
/// Ok(received) => println!("received {received} bytes {:?}", &buf[..received]),
/// Err(e) => println!("recv function failed: {e:?}"),
/// }
/// ```
#[stable(feature = "net2_mutators", since = "1.9.0")]
@@ -726,8 +726,8 @@ impl UdpSocket {
/// socket.connect("127.0.0.1:8080").expect("connect function failed");
/// let mut buf = [0; 10];
/// match socket.peek(&mut buf) {
/// Ok(received) => println!("received {} bytes", received),
/// Err(e) => println!("peek function failed: {:?}", e),
/// Ok(received) => println!("received {received} bytes"),
/// Err(e) => println!("peek function failed: {e:?}"),
/// }
/// ```
#[stable(feature = "peek", since = "1.18.0")]
@@ -770,7 +770,7 @@ impl UdpSocket {
/// // via platform-specific APIs such as epoll or IOCP
/// wait_for_fd();
/// }
/// Err(e) => panic!("encountered IO error: {}", e),
/// Err(e) => panic!("encountered IO error: {e}"),
/// }
/// };
/// println!("bytes: {:?}", &buf[..num_bytes_read]);