diff options
| author | T-O-R-U-S <bageliq@protonmail.com> | 2022-02-12 23:16:17 +0400 |
|---|---|---|
| committer | Mark Rousskov <mark.simulacrum@gmail.com> | 2022-03-10 10:23:40 -0500 |
| commit | 72a25d05bf1a4b155d74139ef700ff93af6d8e22 (patch) | |
| tree | 3f143b29a3a51b68e9b29d93e47fb0b0968ad3df /library/core/src/str/mod.rs | |
| parent | ba14a836c7038da21f5e102aacc7e6d5964f79a6 (diff) | |
| download | rust-72a25d05bf1a4b155d74139ef700ff93af6d8e22.tar.gz rust-72a25d05bf1a4b155d74139ef700ff93af6d8e22.zip | |
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).
Diffstat (limited to 'library/core/src/str/mod.rs')
| -rw-r--r-- | library/core/src/str/mod.rs | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/library/core/src/str/mod.rs b/library/core/src/str/mod.rs index f66bab999a9..b1d36f27107 100644 --- a/library/core/src/str/mod.rs +++ b/library/core/src/str/mod.rs @@ -104,7 +104,7 @@ fn slice_error_fail_rt(s: &str, begin: usize, end: usize) -> ! { // 1. out of bounds if begin > s.len() || end > s.len() { let oob_index = if begin > s.len() { begin } else { end }; - panic!("byte index {} is out of bounds of `{}`{}", oob_index, s_trunc, ellipsis); + panic!("byte index {oob_index} is out of bounds of `{s_trunc}`{ellipsis}"); } // 2. begin <= end @@ -2446,7 +2446,7 @@ impl str { /// /// ``` /// for c in "❤\n!".escape_debug() { - /// print!("{}", c); + /// print!("{c}"); /// } /// println!(); /// ``` @@ -2492,7 +2492,7 @@ impl str { /// /// ``` /// for c in "❤\n!".escape_default() { - /// print!("{}", c); + /// print!("{c}"); /// } /// println!(); /// ``` @@ -2530,7 +2530,7 @@ impl str { /// /// ``` /// for c in "❤\n!".escape_unicode() { - /// print!("{}", c); + /// print!("{c}"); /// } /// println!(); /// ``` |
