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 /src | |
| 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 'src')
| -rw-r--r-- | src/doc/rustdoc/src/how-to-write-documentation.md | 2 | ||||
| -rw-r--r-- | src/doc/unstable-book/src/compiler-flags/sanitizer.md | 8 | ||||
| -rw-r--r-- | src/doc/unstable-book/src/language-features/box-patterns.md | 4 | ||||
| -rw-r--r-- | src/librustdoc/clean/mod.rs | 2 | ||||
| -rw-r--r-- | src/librustdoc/doctest.rs | 39 | ||||
| -rw-r--r-- | src/librustdoc/html/markdown.rs | 2 | ||||
| -rw-r--r-- | src/librustdoc/markdown.rs | 2 | ||||
| -rw-r--r-- | src/tools/tidy/src/bins.rs | 2 | ||||
| -rw-r--r-- | src/tools/tidy/src/deps.rs | 14 | ||||
| -rw-r--r-- | src/tools/tidy/src/error_codes_check.rs | 4 | ||||
| -rw-r--r-- | src/tools/tidy/src/features.rs | 8 | ||||
| -rw-r--r-- | src/tools/tidy/src/primitive_docs.rs | 6 | ||||
| -rw-r--r-- | src/tools/tidy/src/style.rs | 10 | ||||
| -rw-r--r-- | src/tools/tidy/src/target_specific_tests.rs | 4 | ||||
| -rw-r--r-- | src/tools/unicode-table-generator/src/main.rs | 10 | ||||
| -rw-r--r-- | src/tools/unicode-table-generator/src/unicode_download.rs | 5 | ||||
| -rw-r--r-- | src/tools/unstable-book-gen/src/main.rs | 2 | ||||
| -rw-r--r-- | src/tools/x/src/main.rs | 2 |
18 files changed, 62 insertions, 64 deletions
diff --git a/src/doc/rustdoc/src/how-to-write-documentation.md b/src/doc/rustdoc/src/how-to-write-documentation.md index f89495cca3a..38fd1db5c21 100644 --- a/src/doc/rustdoc/src/how-to-write-documentation.md +++ b/src/doc/rustdoc/src/how-to-write-documentation.md @@ -126,7 +126,7 @@ use std::env; // Prints each argument on a separate line for argument in env::args() { - println!("{}", argument); + println!("{argument}"); } ``` diff --git a/src/doc/unstable-book/src/compiler-flags/sanitizer.md b/src/doc/unstable-book/src/compiler-flags/sanitizer.md index 457851b0cc7..735521e667c 100644 --- a/src/doc/unstable-book/src/compiler-flags/sanitizer.md +++ b/src/doc/unstable-book/src/compiler-flags/sanitizer.md @@ -240,7 +240,7 @@ fn do_twice(f: fn(i32) -> i32, arg: i32) -> i32 { fn main() { let answer = do_twice(add_one, 5); - println!("The answer is: {}", answer); + println!("The answer is: {answer}"); println!("With CFI enabled, you should not see the next answer"); let f: fn(i32) -> i32 = unsafe { @@ -250,7 +250,7 @@ fn main() { }; let next_answer = do_twice(f, 5); - println!("The next answer is: {}", next_answer); + println!("The next answer is: {next_answer}"); } ``` Fig. 1. Modified example from the [Advanced Functions and @@ -303,14 +303,14 @@ fn do_twice(f: fn(i32) -> i32, arg: i32) -> i32 { fn main() { let answer = do_twice(add_one, 5); - println!("The answer is: {}", answer); + println!("The answer is: {answer}"); println!("With CFI enabled, you should not see the next answer"); let f: fn(i32) -> i32 = unsafe { mem::transmute::<*const u8, fn(i32) -> i32>(add_two as *const u8) }; let next_answer = do_twice(f, 5); - println!("The next answer is: {}", next_answer); + println!("The next answer is: {next_answer}"); } ``` Fig. 4. Another modified example from the [Advanced Functions and diff --git a/src/doc/unstable-book/src/language-features/box-patterns.md b/src/doc/unstable-book/src/language-features/box-patterns.md index bf0819ec920..584f4295cba 100644 --- a/src/doc/unstable-book/src/language-features/box-patterns.md +++ b/src/doc/unstable-book/src/language-features/box-patterns.md @@ -18,10 +18,10 @@ fn main() { let b = Some(Box::new(5)); match b { Some(box n) if n < 0 => { - println!("Box contains negative number {}", n); + println!("Box contains negative number {n}"); }, Some(box n) if n >= 0 => { - println!("Box contains non-negative number {}", n); + println!("Box contains non-negative number {n}"); }, None => { println!("No box"); diff --git a/src/librustdoc/clean/mod.rs b/src/librustdoc/clean/mod.rs index 29c11c7b28a..fa0030a9360 100644 --- a/src/librustdoc/clean/mod.rs +++ b/src/librustdoc/clean/mod.rs @@ -829,7 +829,7 @@ fn clean_fn_decl_legacy_const_generics(func: &mut Function, attrs: &[ast::Attrib .values .insert(a as _, Argument { name, type_: *ty, is_const: true }); } else { - panic!("unexpected non const in position {}", pos); + panic!("unexpected non const in position {pos}"); } } _ => panic!("invalid arg index"), diff --git a/src/librustdoc/doctest.rs b/src/librustdoc/doctest.rs index 63a8e85f7c5..e9efeba0299 100644 --- a/src/librustdoc/doctest.rs +++ b/src/librustdoc/doctest.rs @@ -197,7 +197,7 @@ crate fn run(options: RustdocOptions) -> Result<(), ErrorGuaranteed> { .to_string(); let uext = UnusedExterns { lint_level, unused_extern_names }; let unused_extern_json = serde_json::to_string(&uext).unwrap(); - eprintln!("{}", unused_extern_json); + eprintln!("{unused_extern_json}"); } } @@ -430,7 +430,7 @@ fn run_test( // We used to check if the output contained "error[{}]: " but since we added the // colored output, we can't anymore because of the color escape characters before // the ":". - lang_string.error_codes.retain(|err| !out.contains(&format!("error[{}]", err))); + lang_string.error_codes.retain(|err| !out.contains(&format!("error[{err}]"))); if !lang_string.error_codes.is_empty() { return Err(TestFailure::MissingErrorCodes(lang_string.error_codes)); @@ -510,7 +510,7 @@ crate fn make_test( // Next, any attributes that came from the crate root via #![doc(test(attr(...)))]. for attr in &opts.attrs { - prog.push_str(&format!("#![{}]\n", attr)); + prog.push_str(&format!("#![{attr}]\n")); line_offset += 1; } @@ -647,7 +647,7 @@ crate fn make_test( // parse the source, but only has false positives, not false // negatives. if s.contains(crate_name) { - prog.push_str(&format!("extern crate r#{};\n", crate_name)); + prog.push_str(&format!("extern crate r#{crate_name};\n")); line_offset += 1; } } @@ -661,7 +661,7 @@ crate fn make_test( // Give each doctest main function a unique name. // This is for example needed for the tooling around `-C instrument-coverage`. let inner_fn_name = if let Some(test_id) = test_id { - format!("_doctest_main_{}", test_id) + format!("_doctest_main_{test_id}") } else { "_inner".into() }; @@ -669,15 +669,14 @@ crate fn make_test( let (main_pre, main_post) = if returns_result { ( format!( - "fn main() {{ {}fn {}() -> Result<(), impl core::fmt::Debug> {{\n", - inner_attr, inner_fn_name + "fn main() {{ {inner_attr}fn {inner_fn_name}() -> Result<(), impl core::fmt::Debug> {{\n", ), - format!("\n}} {}().unwrap() }}", inner_fn_name), + format!("\n}} {inner_fn_name}().unwrap() }}"), ) } else if test_id.is_some() { ( - format!("fn main() {{ {}fn {}() {{\n", inner_attr, inner_fn_name), - format!("\n}} {}() }}", inner_fn_name), + format!("fn main() {{ {inner_attr}fn {inner_fn_name}() {{\n",), + format!("\n}} {inner_fn_name}() }}"), ) } else { ("fn main() {\n".into(), "\n}".into()) @@ -695,7 +694,7 @@ crate fn make_test( prog.extend([&main_pre, everything_else, &main_post].iter().cloned()); } - debug!("final doctest:\n{}", prog); + debug!("final doctest:\n{prog}"); (prog, line_offset, supports_color) } @@ -763,9 +762,9 @@ fn partition_source(s: &str) -> (String, String, String) { } } - debug!("before:\n{}", before); - debug!("crates:\n{}", crates); - debug!("after:\n{}", after); + debug!("before:\n{before}"); + debug!("crates:\n{crates}"); + debug!("after:\n{after}"); (before, after, crates) } @@ -940,7 +939,7 @@ impl Tester for Collector { ) }; - debug!("creating test {}: {}", name, test); + debug!("creating test {name}: {test}"); self.tests.push(test::TestDescAndFn { desc: test::TestDesc { name: test::DynTestName(name), @@ -994,19 +993,19 @@ impl Tester for Collector { eprint!("Some expected error codes were not found: {:?}", codes); } TestFailure::ExecutionError(err) => { - eprint!("Couldn't run the test: {}", err); + eprint!("Couldn't run the test: {err}"); if err.kind() == io::ErrorKind::PermissionDenied { eprint!(" - maybe your tempdir is mounted with noexec?"); } } TestFailure::ExecutionFailure(out) => { let reason = if let Some(code) = out.status.code() { - format!("exit code {}", code) + format!("exit code {code}") } else { String::from("terminated by signal") }; - eprintln!("Test executable failed ({}).", reason); + eprintln!("Test executable failed ({reason})."); // FIXME(#12309): An unfortunate side-effect of capturing the test // executable's output is that the relative ordering between the test's @@ -1024,11 +1023,11 @@ impl Tester for Collector { eprintln!(); if !stdout.is_empty() { - eprintln!("stdout:\n{}", stdout); + eprintln!("stdout:\n{stdout}"); } if !stderr.is_empty() { - eprintln!("stderr:\n{}", stderr); + eprintln!("stderr:\n{stderr}"); } } } diff --git a/src/librustdoc/html/markdown.rs b/src/librustdoc/html/markdown.rs index 7061a9674e4..98dc625b36d 100644 --- a/src/librustdoc/html/markdown.rs +++ b/src/librustdoc/html/markdown.rs @@ -1314,7 +1314,7 @@ crate fn markdown_links(md: &str) -> Vec<MarkdownLink> { for ev in iter { if let Event::Start(Tag::Link(kind, dest, _)) = ev.0 { - debug!("found link: {}", dest); + debug!("found link: {dest}"); let span = span_for_link(&dest, ev.1); links.borrow_mut().push(MarkdownLink { kind, link: dest.into_string(), range: span }); } diff --git a/src/librustdoc/markdown.rs b/src/librustdoc/markdown.rs index 906b8f8a245..a1f92afad46 100644 --- a/src/librustdoc/markdown.rs +++ b/src/librustdoc/markdown.rs @@ -51,7 +51,7 @@ crate fn render<P: AsRef<Path>>( let mut css = String::new(); for name in &options.markdown_css { - let s = format!("<link rel=\"stylesheet\" type=\"text/css\" href=\"{}\">\n", name); + let s = format!("<link rel=\"stylesheet\" type=\"text/css\" href=\"{name}\">\n"); css.push_str(&s) } diff --git a/src/tools/tidy/src/bins.rs b/src/tools/tidy/src/bins.rs index 1d5ec5c31c6..503df537047 100644 --- a/src/tools/tidy/src/bins.rs +++ b/src/tools/tidy/src/bins.rs @@ -117,7 +117,7 @@ mod os_impl { .stderr(Stdio::null()) .output() .unwrap_or_else(|e| { - panic!("could not run git ls-files: {}", e); + panic!("could not run git ls-files: {e}"); }); let path_bytes = rel_path.as_os_str().as_bytes(); if output.status.success() && output.stdout.starts_with(path_bytes) { diff --git a/src/tools/tidy/src/deps.rs b/src/tools/tidy/src/deps.rs index 52429fee461..d6e36c2e7db 100644 --- a/src/tools/tidy/src/deps.rs +++ b/src/tools/tidy/src/deps.rs @@ -340,8 +340,8 @@ fn check_exceptions( } Some(pkg_license) => { if pkg_license.as_str() != *license { - println!("dependency exception `{}` license has changed", name); - println!(" previously `{}` now `{}`", license, pkg_license); + println!("dependency exception `{name}` license has changed"); + println!(" previously `{license}` now `{pkg_license}`"); println!(" update EXCEPTIONS for the new license"); *bad = true; } @@ -418,7 +418,7 @@ fn check_dependencies( if !unapproved.is_empty() { tidy_error!(bad, "Dependencies not explicitly permitted:"); for dep in unapproved { - println!("* {}", dep); + println!("* {dep}"); } } } @@ -501,7 +501,7 @@ fn deps_of<'a>(metadata: &'a Metadata, pkg_id: &'a PackageId) -> Vec<&'a Package .nodes .iter() .find(|n| &n.id == pkg_id) - .unwrap_or_else(|| panic!("could not find `{}` in resolve", pkg_id)); + .unwrap_or_else(|| panic!("could not find `{pkg_id}` in resolve")); node.deps .iter() .map(|dep| { @@ -516,8 +516,8 @@ fn deps_of<'a>(metadata: &'a Metadata, pkg_id: &'a PackageId) -> Vec<&'a Package fn pkg_from_name<'a>(metadata: &'a Metadata, name: &'static str) -> &'a Package { let mut i = metadata.packages.iter().filter(|p| p.name == name); let result = - i.next().unwrap_or_else(|| panic!("could not find package `{}` in package list", name)); - assert!(i.next().is_none(), "more than one package found for `{}`", name); + i.next().unwrap_or_else(|| panic!("could not find package `{name}` in package list")); + assert!(i.next().is_none(), "more than one package found for `{name}`"); result } @@ -545,7 +545,7 @@ fn normal_deps_of_r<'a>( .nodes .iter() .find(|n| &n.id == pkg_id) - .unwrap_or_else(|| panic!("could not find `{}` in resolve", pkg_id)); + .unwrap_or_else(|| panic!("could not find `{pkg_id}` in resolve")); for dep in &node.deps { normal_deps_of_r(resolve, &dep.pkg, result); } diff --git a/src/tools/tidy/src/error_codes_check.rs b/src/tools/tidy/src/error_codes_check.rs index f6be550283a..281773b0569 100644 --- a/src/tools/tidy/src/error_codes_check.rs +++ b/src/tools/tidy/src/error_codes_check.rs @@ -260,7 +260,7 @@ pub fn check(paths: &[&Path], bad: &mut bool) { for (err_code, error_status) in &error_codes { if !error_status.has_test && !EXEMPTED_FROM_TEST.contains(&err_code.as_str()) { - errors.push(format!("Error code {} needs to have at least one UI test!", err_code)); + errors.push(format!("Error code {err_code} needs to have at least one UI test!")); } else if error_status.has_test && EXEMPTED_FROM_TEST.contains(&err_code.as_str()) { errors.push(format!( "Error code {} has a UI test, it shouldn't be listed into EXEMPTED_FROM_TEST!", @@ -309,7 +309,7 @@ pub fn check(paths: &[&Path], bad: &mut bool) { } errors.sort(); for err in &errors { - eprintln!("{}", err); + eprintln!("{err}"); } println!("Found {} error(s) in error codes", errors.len()); if !errors.is_empty() { diff --git a/src/tools/tidy/src/features.rs b/src/tools/tidy/src/features.rs index 9b6037c6a4b..2f22c081a54 100644 --- a/src/tools/tidy/src/features.rs +++ b/src/tools/tidy/src/features.rs @@ -157,7 +157,7 @@ pub fn check( .collect::<Vec<_>>(); for &(name, _) in gate_untested.iter() { - println!("Expected a gate test for the feature '{}'.", name); + println!("Expected a gate test for the feature '{name}'."); println!( "Hint: create a failing test file named 'feature-gate-{}.rs'\ \n in the 'ui' test suite, with its failures due to\ @@ -186,7 +186,7 @@ pub fn check( lines.sort(); for line in lines { - println!("* {}", line); + println!("* {line}"); } } else { println!("* {} features", features.len()); @@ -221,7 +221,7 @@ fn find_attr_val<'a>(line: &'a str, attr: &str) -> Option<&'a str> { "issue" => &*ISSUE, "feature" => &*FEATURE, "since" => &*SINCE, - _ => unimplemented!("{} not handled", attr), + _ => unimplemented!("{attr} not handled"), }; r.captures(line).and_then(|c| c.get(1)).map(|m| m.as_str()) @@ -231,7 +231,7 @@ fn test_filen_gate(filen_underscore: &str, features: &mut Features) -> bool { let prefix = "feature_gate_"; if filen_underscore.starts_with(prefix) { for (n, f) in features.iter_mut() { - // Equivalent to filen_underscore == format!("feature_gate_{}", n) + // Equivalent to filen_underscore == format!("feature_gate_{n}") if &filen_underscore[prefix.len()..] == n { f.has_gate_test = true; return true; diff --git a/src/tools/tidy/src/primitive_docs.rs b/src/tools/tidy/src/primitive_docs.rs index 8476650d9b5..f3200e0afd7 100644 --- a/src/tools/tidy/src/primitive_docs.rs +++ b/src/tools/tidy/src/primitive_docs.rs @@ -8,10 +8,10 @@ pub fn check(library_path: &Path, bad: &mut bool) { let std_name = "std/src/primitive_docs.rs"; let core_name = "core/src/primitive_docs.rs"; let std_contents = std::fs::read_to_string(library_path.join(std_name)) - .unwrap_or_else(|e| panic!("failed to read library/{}: {}", std_name, e)); + .unwrap_or_else(|e| panic!("failed to read library/{std_name}: {e}")); let core_contents = std::fs::read_to_string(library_path.join(core_name)) - .unwrap_or_else(|e| panic!("failed to read library/{}: {}", core_name, e)); + .unwrap_or_else(|e| panic!("failed to read library/{core_name}: {e}")); if std_contents != core_contents { - tidy_error!(bad, "library/{} and library/{} have different contents", core_name, std_name); + tidy_error!(bad, "library/{core_name} and library/{std_name} have different contents"); } } diff --git a/src/tools/tidy/src/style.rs b/src/tools/tidy/src/style.rs index c197acd4828..9861cba410d 100644 --- a/src/tools/tidy/src/style.rs +++ b/src/tools/tidy/src/style.rs @@ -153,9 +153,9 @@ fn contains_ignore_directive(can_contain: bool, contents: &str, check: &str) -> return Directive::Deny; } // Update `can_contain` when changing this - if contents.contains(&format!("// ignore-tidy-{}", check)) - || contents.contains(&format!("# ignore-tidy-{}", check)) - || contents.contains(&format!("/* ignore-tidy-{} */", check)) + if contents.contains(&format!("// ignore-tidy-{check}")) + || contents.contains(&format!("# ignore-tidy-{check}")) + || contents.contains(&format!("/* ignore-tidy-{check} */")) { Directive::Ignore(false) } else { @@ -294,7 +294,7 @@ pub fn check(path: &Path, bad: &mut bool) { suppressible_tidy_err!( err, skip_line_length, - &format!("line longer than {} chars", max_columns) + &format!("line longer than {max_columns} chars") ); } if !is_style_file && line.contains('\t') { @@ -381,7 +381,7 @@ pub fn check(path: &Path, bad: &mut bool) { n => suppressible_tidy_err!( err, skip_trailing_newlines, - &format!("too many trailing newlines ({})", n) + &format!("too many trailing newlines ({n})") ), }; if lines > LINES { diff --git a/src/tools/tidy/src/target_specific_tests.rs b/src/tools/tidy/src/target_specific_tests.rs index 8e1749196d2..723684bfa4c 100644 --- a/src/tools/tidy/src/target_specific_tests.rs +++ b/src/tools/tidy/src/target_specific_tests.rs @@ -20,7 +20,7 @@ fn iter_header<'a>(contents: &'a str, it: &mut dyn FnMut(Option<&'a str>, &'a st let lncfg = &ln[open_brace + 1..close_brace]; it(Some(lncfg), ln[(close_brace + 1)..].trim_start()); } else { - panic!("malformed condition directive: expected `//[foo]`, found `{}`", ln) + panic!("malformed condition directive: expected `//[foo]`, found `{ln}`") } } else if ln.starts_with(COMMENT) { it(None, ln[COMMENT.len()..].trim_start()); @@ -61,7 +61,7 @@ pub fn check(path: &Path, bad: &mut bool) { let info = header_map.entry(cfg).or_insert(RevisionInfo::default()); info.target_arch.replace(arch); } else { - eprintln!("{}: seems to have a malformed --target value", file); + eprintln!("{file}: seems to have a malformed --target value"); *bad = true; } } diff --git a/src/tools/unicode-table-generator/src/main.rs b/src/tools/unicode-table-generator/src/main.rs index 218e9668df4..4720ee7020f 100644 --- a/src/tools/unicode-table-generator/src/main.rs +++ b/src/tools/unicode-table-generator/src/main.rs @@ -277,7 +277,7 @@ fn main() { for (name, contents) in modules { table_file.push_str("#[rustfmt::skip]\n"); - table_file.push_str(&format!("pub mod {} {{\n", name)); + table_file.push_str(&format!("pub mod {name} {{\n")); for line in contents.lines() { if !line.trim().is_empty() { table_file.push_str(" "); @@ -290,7 +290,7 @@ fn main() { std::fs::write(&write_location, format!("{}\n", table_file.trim_end())).unwrap(); - println!("Total table sizes: {} bytes", total_bytes); + println!("Total table sizes: {total_bytes} bytes"); } fn version() -> String { @@ -308,7 +308,7 @@ fn version() -> String { readme[start..end].split('.').map(|v| v.parse::<u32>().expect(&v)).collect::<Vec<_>>(); let [major, minor, micro] = [version[0], version[1], version[2]]; - out.push_str(&format!("({}, {}, {});\n", major, minor, micro)); + out.push_str(&format!("({major}, {minor}, {micro});\n")); out } @@ -322,7 +322,7 @@ fn fmt_list<V: std::fmt::Debug>(values: impl IntoIterator<Item = V>) -> String { } else { out.push_str(line.trim_end()); out.push('\n'); - line = format!(" {}", piece); + line = format!(" {piece}"); } } out.push_str(line.trim_end()); @@ -335,7 +335,7 @@ fn generate_tests(data_path: &str, ranges: &[(&str, Vec<Range<u32>>)]) -> String s.push_str("#![allow(incomplete_features, unused)]\n"); s.push_str("#![feature(const_generics)]\n\n"); s.push_str("\n#[allow(unused)]\nuse std::hint;\n"); - s.push_str(&format!("#[path = \"{}\"]\n", data_path)); + s.push_str(&format!("#[path = \"{data_path}\"]\n")); s.push_str("mod unicode_data;\n\n"); s.push_str("\nfn main() {\n"); diff --git a/src/tools/unicode-table-generator/src/unicode_download.rs b/src/tools/unicode-table-generator/src/unicode_download.rs index fa57f650ac0..9b2e0a25891 100644 --- a/src/tools/unicode-table-generator/src/unicode_download.rs +++ b/src/tools/unicode-table-generator/src/unicode_download.rs @@ -13,13 +13,12 @@ pub fn fetch_latest() { let directory = Path::new(UNICODE_DIRECTORY); if directory.exists() { eprintln!( - "Not refetching unicode data, already exists, please delete {:?} to regenerate", - directory + "Not refetching unicode data, already exists, please delete {directory:?} to regenerate", ); return; } if let Err(e) = std::fs::create_dir_all(directory) { - panic!("Failed to create {:?}: {}", UNICODE_DIRECTORY, e); + panic!("Failed to create {UNICODE_DIRECTORY:?}: {e}"); } let output = Command::new("curl").arg(URL_PREFIX.to_owned() + README).output().unwrap(); if !output.status.success() { diff --git a/src/tools/unstable-book-gen/src/main.rs b/src/tools/unstable-book-gen/src/main.rs index e10f72a47b2..5a0477b4b94 100644 --- a/src/tools/unstable-book-gen/src/main.rs +++ b/src/tools/unstable-book-gen/src/main.rs @@ -67,7 +67,7 @@ fn generate_unstable_book_files(src: &Path, out: &Path, features: &Features) { t!(fs::create_dir_all(&out)); for feature_name in &unstable_features - &unstable_section_file_names { let feature_name_underscore = feature_name.replace('-', "_"); - let file_name = format!("{}.md", feature_name); + let file_name = format!("{feature_name}.md"); let out_file_path = out.join(&file_name); let feature = &features[&feature_name_underscore]; diff --git a/src/tools/x/src/main.rs b/src/tools/x/src/main.rs index 6c0311433d6..8c47559b369 100644 --- a/src/tools/x/src/main.rs +++ b/src/tools/x/src/main.rs @@ -58,7 +58,7 @@ fn main() { let current = match env::current_dir() { Ok(dir) => dir, Err(err) => { - eprintln!("Failed to get current directory: {}", err); + eprintln!("Failed to get current directory: {err}"); process::exit(1); } }; |
