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

@ -895,7 +895,7 @@ pub(crate) mod builtin {
///
/// ```
/// let path: &'static str = env!("PATH");
/// println!("the $PATH variable at the time of compiling was: {}", path);
/// println!("the $PATH variable at the time of compiling was: {path}");
/// ```
///
/// You can customize the error message by passing a string as the second
@ -935,7 +935,7 @@ pub(crate) mod builtin {
///
/// ```
/// let key: Option<&'static str> = option_env!("SECRET_KEY");
/// println!("the secret key might be: {:?}", key);
/// println!("the secret key might be: {key:?}");
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
#[rustc_builtin_macro]
@ -1046,7 +1046,7 @@ pub(crate) mod builtin {
///
/// ```
/// let current_line = line!();
/// println!("defined on line: {}", current_line);
/// println!("defined on line: {current_line}");
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
#[rustc_builtin_macro]
@ -1074,7 +1074,7 @@ pub(crate) mod builtin {
///
/// ```
/// let current_col = column!();
/// println!("defined on column: {}", current_col);
/// println!("defined on column: {current_col}");
/// ```
///
/// `column!` counts Unicode code points, not bytes or graphemes. As a result, the first two
@ -1112,7 +1112,7 @@ pub(crate) mod builtin {
///
/// ```
/// let this_file = file!();
/// println!("defined in file: {}", this_file);
/// println!("defined in file: {this_file}");
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
#[rustc_builtin_macro]
@ -1176,7 +1176,7 @@ pub(crate) mod builtin {
/// fn main() {
/// let my_str = include_str!("spanish.in");
/// assert_eq!(my_str, "adiós\n");
/// print!("{}", my_str);
/// print!("{my_str}");
/// }
/// ```
///
@ -1325,7 +1325,7 @@ pub(crate) mod builtin {
/// fn main() {
/// let my_string = include!("monkeys.in");
/// assert_eq!("🙈🙊🙉🙈🙊🙉", my_string);
/// println!("{}", my_string);
/// println!("{my_string}");
/// }
/// ```
///