diff options
Diffstat (limited to 'src/tools/tidy/src')
| -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 |
7 files changed, 24 insertions, 24 deletions
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; } } |
