diff options
| author | Pietro Albini <pietro@pietroalbini.org> | 2025-05-10 10:55:10 +0200 |
|---|---|---|
| committer | Pietro Albini <pietro@pietroalbini.org> | 2025-05-12 15:33:39 +0200 |
| commit | 8e4b1c89f4515415244c623489b820eeed08edf4 (patch) | |
| tree | fdadd7deaed427450280929b52fba16ab42ae0f4 | |
| parent | 27cca0db9b00bf6e8451a146b46e168cda13c8ef (diff) | |
| download | rust-8e4b1c89f4515415244c623489b820eeed08edf4.tar.gz rust-8e4b1c89f4515415244c623489b820eeed08edf4.zip | |
./x clippy ci --fix
| -rw-r--r-- | src/bootstrap/src/bin/rustc.rs | 4 | ||||
| -rw-r--r-- | src/bootstrap/src/core/build_steps/clean.rs | 2 | ||||
| -rw-r--r-- | src/bootstrap/src/core/build_steps/clippy.rs | 2 | ||||
| -rw-r--r-- | src/bootstrap/src/core/build_steps/compile.rs | 2 | ||||
| -rw-r--r-- | src/bootstrap/src/core/build_steps/dist.rs | 10 | ||||
| -rw-r--r-- | src/bootstrap/src/core/build_steps/install.rs | 2 | ||||
| -rw-r--r-- | src/bootstrap/src/core/build_steps/llvm.rs | 22 | ||||
| -rw-r--r-- | src/bootstrap/src/core/build_steps/setup.rs | 4 | ||||
| -rw-r--r-- | src/bootstrap/src/core/build_steps/test.rs | 4 | ||||
| -rw-r--r-- | src/bootstrap/src/core/builder/cargo.rs | 2 | ||||
| -rw-r--r-- | src/bootstrap/src/core/builder/mod.rs | 7 | ||||
| -rw-r--r-- | src/bootstrap/src/core/config/config.rs | 4 | ||||
| -rw-r--r-- | src/bootstrap/src/core/download.rs | 4 | ||||
| -rw-r--r-- | src/bootstrap/src/core/sanity.rs | 4 | ||||
| -rw-r--r-- | src/bootstrap/src/utils/helpers.rs | 4 | ||||
| -rw-r--r-- | src/bootstrap/src/utils/shared_helpers.rs | 2 |
16 files changed, 39 insertions, 40 deletions
diff --git a/src/bootstrap/src/bin/rustc.rs b/src/bootstrap/src/bin/rustc.rs index d8cae02456c..85c682a46c5 100644 --- a/src/bootstrap/src/bin/rustc.rs +++ b/src/bootstrap/src/bin/rustc.rs @@ -58,8 +58,8 @@ fn main() { let sysroot = env::var_os("RUSTC_SYSROOT").expect("RUSTC_SYSROOT was not set"); let on_fail = env::var_os("RUSTC_ON_FAIL").map(Command::new); - let rustc_real = env::var_os(rustc).unwrap_or_else(|| panic!("{:?} was not set", rustc)); - let libdir = env::var_os(libdir).unwrap_or_else(|| panic!("{:?} was not set", libdir)); + let rustc_real = env::var_os(rustc).unwrap_or_else(|| panic!("{rustc:?} was not set")); + let libdir = env::var_os(libdir).unwrap_or_else(|| panic!("{libdir:?} was not set")); let mut dylib_path = dylib_path(); dylib_path.insert(0, PathBuf::from(&libdir)); diff --git a/src/bootstrap/src/core/build_steps/clean.rs b/src/bootstrap/src/core/build_steps/clean.rs index 21e9fea9363..882fcd08780 100644 --- a/src/bootstrap/src/core/build_steps/clean.rs +++ b/src/bootstrap/src/core/build_steps/clean.rs @@ -129,7 +129,7 @@ fn clean_specific_stage(build: &Build, stage: u32) { for entry in entries { let entry = t!(entry); - let stage_prefix = format!("stage{}", stage); + let stage_prefix = format!("stage{stage}"); // if current entry is not related with the target stage, continue if !entry.file_name().to_str().unwrap_or("").contains(&stage_prefix) { diff --git a/src/bootstrap/src/core/build_steps/clippy.rs b/src/bootstrap/src/core/build_steps/clippy.rs index d3ab215d1b5..07fd51919d4 100644 --- a/src/bootstrap/src/core/build_steps/clippy.rs +++ b/src/bootstrap/src/core/build_steps/clippy.rs @@ -59,7 +59,7 @@ fn lint_args(builder: &Builder<'_>, config: &LintConfig, ignored_rules: &[&str]) let all_args = std::env::args().collect::<Vec<_>>(); args.extend(get_clippy_rules_in_order(&all_args, config)); - args.extend(ignored_rules.iter().map(|lint| format!("-Aclippy::{}", lint))); + args.extend(ignored_rules.iter().map(|lint| format!("-Aclippy::{lint}"))); args.extend(builder.config.free_args.clone()); args } diff --git a/src/bootstrap/src/core/build_steps/compile.rs b/src/bootstrap/src/core/build_steps/compile.rs index 2e5865e5096..67daf81ee54 100644 --- a/src/bootstrap/src/core/build_steps/compile.rs +++ b/src/bootstrap/src/core/build_steps/compile.rs @@ -1771,7 +1771,7 @@ impl Step for Sysroot { } else if builder.download_rustc() && compiler.stage != builder.top_stage { host_dir.join("ci-rustc-sysroot") } else { - host_dir.join(format!("stage{}", stage)) + host_dir.join(format!("stage{stage}")) } }; let sysroot = sysroot_dir(compiler.stage); diff --git a/src/bootstrap/src/core/build_steps/dist.rs b/src/bootstrap/src/core/build_steps/dist.rs index 3c412683b94..aa2c7509c2a 100644 --- a/src/bootstrap/src/core/build_steps/dist.rs +++ b/src/bootstrap/src/core/build_steps/dist.rs @@ -1403,14 +1403,14 @@ impl Step for CodegenBackend { let backend = self.backend; let mut tarball = - Tarball::new(builder, &format!("rustc-codegen-{}", backend), &compiler.host.triple); + Tarball::new(builder, &format!("rustc-codegen-{backend}"), &compiler.host.triple); if backend == "cranelift" { tarball.set_overlay(OverlayKind::RustcCodegenCranelift); } else { - panic!("Unknown backend rustc_codegen_{}", backend); + panic!("Unknown backend rustc_codegen_{backend}"); } tarball.is_preview(true); - tarball.add_legal_and_readme_to(format!("share/doc/rustc_codegen_{}", backend)); + tarball.add_legal_and_readme_to(format!("share/doc/rustc_codegen_{backend}")); let src = builder.sysroot(compiler); let backends_src = builder.sysroot_codegen_backends(compiler); @@ -1422,7 +1422,7 @@ impl Step for CodegenBackend { // Don't use custom libdir here because ^lib/ will be resolved again with installer let backends_dst = PathBuf::from("lib").join(backends_rel); - let backend_name = format!("rustc_codegen_{}", backend); + let backend_name = format!("rustc_codegen_{backend}"); let mut found_backend = false; for backend in fs::read_dir(&backends_src).unwrap() { let file_name = backend.unwrap().file_name(); @@ -1623,7 +1623,7 @@ impl Step for Extended { let pkgbuild = |component: &str| { let mut cmd = command("pkgbuild"); cmd.arg("--identifier") - .arg(format!("org.rust-lang.{}", component)) + .arg(format!("org.rust-lang.{component}")) .arg("--scripts") .arg(pkg.join(component)) .arg("--nopayload") diff --git a/src/bootstrap/src/core/build_steps/install.rs b/src/bootstrap/src/core/build_steps/install.rs index 3e5069225d2..c31c40e846b 100644 --- a/src/bootstrap/src/core/build_steps/install.rs +++ b/src/bootstrap/src/core/build_steps/install.rs @@ -53,7 +53,7 @@ fn is_dir_writable_for_user(dir: &Path) -> bool { if e.kind() == std::io::ErrorKind::PermissionDenied { false } else { - panic!("Failed the write access check for the current user. {}", e); + panic!("Failed the write access check for the current user. {e}"); } } } diff --git a/src/bootstrap/src/core/build_steps/llvm.rs b/src/bootstrap/src/core/build_steps/llvm.rs index 86af956535e..33a35372d18 100644 --- a/src/bootstrap/src/core/build_steps/llvm.rs +++ b/src/bootstrap/src/core/build_steps/llvm.rs @@ -870,8 +870,8 @@ fn get_var(var_base: &str, host: &str, target: &str) -> Option<OsString> { let kind = if host == target { "HOST" } else { "TARGET" }; let target_u = target.replace('-', "_"); env::var_os(format!("{var_base}_{target}")) - .or_else(|| env::var_os(format!("{}_{}", var_base, target_u))) - .or_else(|| env::var_os(format!("{}_{}", kind, var_base))) + .or_else(|| env::var_os(format!("{var_base}_{target_u}"))) + .or_else(|| env::var_os(format!("{kind}_{var_base}"))) .or_else(|| env::var_os(var_base)) } @@ -944,7 +944,7 @@ impl Step for Enzyme { } trace!(?target, "(re)building enzyme artifacts"); - builder.info(&format!("Building Enzyme for {}", target)); + builder.info(&format!("Building Enzyme for {target}")); t!(stamp.remove()); let _time = helpers::timeit(builder); t!(fs::create_dir_all(&out_dir)); @@ -1229,10 +1229,10 @@ fn supported_sanitizers( components .iter() .map(move |c| SanitizerRuntime { - cmake_target: format!("clang_rt.{}_{}_dynamic", c, os), + cmake_target: format!("clang_rt.{c}_{os}_dynamic"), path: out_dir - .join(format!("build/lib/darwin/libclang_rt.{}_{}_dynamic.dylib", c, os)), - name: format!("librustc-{}_rt.{}.dylib", channel, c), + .join(format!("build/lib/darwin/libclang_rt.{c}_{os}_dynamic.dylib")), + name: format!("librustc-{channel}_rt.{c}.dylib"), }) .collect() }; @@ -1241,9 +1241,9 @@ fn supported_sanitizers( components .iter() .map(move |c| SanitizerRuntime { - cmake_target: format!("clang_rt.{}-{}", c, arch), - path: out_dir.join(format!("build/lib/{}/libclang_rt.{}-{}.a", os, c, arch)), - name: format!("librustc-{}_rt.{}.a", channel, c), + cmake_target: format!("clang_rt.{c}-{arch}"), + path: out_dir.join(format!("build/lib/{os}/libclang_rt.{c}-{arch}.a")), + name: format!("librustc-{channel}_rt.{c}.a"), }) .collect() }; @@ -1362,8 +1362,8 @@ impl Step for CrtBeginEnd { for obj in objs { let base_name = unhashed_basename(&obj); assert!(base_name == "crtbegin" || base_name == "crtend"); - t!(fs::copy(&obj, out_dir.join(format!("{}S.o", base_name)))); - t!(fs::rename(&obj, out_dir.join(format!("{}.o", base_name)))); + t!(fs::copy(&obj, out_dir.join(format!("{base_name}S.o")))); + t!(fs::rename(&obj, out_dir.join(format!("{base_name}.o")))); } out_dir diff --git a/src/bootstrap/src/core/build_steps/setup.rs b/src/bootstrap/src/core/build_steps/setup.rs index 9d07babe519..31ec462134d 100644 --- a/src/bootstrap/src/core/build_steps/setup.rs +++ b/src/bootstrap/src/core/build_steps/setup.rs @@ -552,7 +552,7 @@ Select which editor you would like to set up [default: None]: "; let mut input = String::new(); loop { - print!("{}", prompt_str); + print!("{prompt_str}"); io::stdout().flush()?; io::stdin().read_line(&mut input)?; @@ -764,7 +764,7 @@ fn create_editor_settings_maybe(config: &Config, editor: &EditorKind) -> io::Res _ => "Created", }; fs::write(&settings_path, editor.settings_template())?; - println!("{verb} `{}`", settings_filename); + println!("{verb} `{settings_filename}`"); } else { println!("\n{}", editor.settings_template()); } diff --git a/src/bootstrap/src/core/build_steps/test.rs b/src/bootstrap/src/core/build_steps/test.rs index 29fb576f574..f708b6e9fd6 100644 --- a/src/bootstrap/src/core/build_steps/test.rs +++ b/src/bootstrap/src/core/build_steps/test.rs @@ -1593,10 +1593,10 @@ NOTE: if you're sure you want to do this, please open an issue as to why. In the let build = builder.build.build; compiler = builder.compiler(compiler.stage - 1, build); let test_stage = compiler.stage + 1; - (test_stage, format!("stage{}-{}", test_stage, build)) + (test_stage, format!("stage{test_stage}-{build}")) } else { let stage = compiler.stage; - (stage, format!("stage{}-{}", stage, target)) + (stage, format!("stage{stage}-{target}")) }; if suite.ends_with("fulldeps") { diff --git a/src/bootstrap/src/core/builder/cargo.rs b/src/bootstrap/src/core/builder/cargo.rs index d625c2ef584..e41f6f16b02 100644 --- a/src/bootstrap/src/core/builder/cargo.rs +++ b/src/bootstrap/src/core/builder/cargo.rs @@ -1278,5 +1278,5 @@ impl Builder<'_> { pub fn cargo_profile_var(name: &str, config: &Config) -> String { let profile = if config.rust_optimize.is_release() { "RELEASE" } else { "DEV" }; - format!("CARGO_PROFILE_{}_{}", profile, name) + format!("CARGO_PROFILE_{profile}_{name}") } diff --git a/src/bootstrap/src/core/builder/mod.rs b/src/bootstrap/src/core/builder/mod.rs index 75cc5d3986b..cc4fa953ddc 100644 --- a/src/bootstrap/src/core/builder/mod.rs +++ b/src/bootstrap/src/core/builder/mod.rs @@ -504,8 +504,8 @@ impl StepDescription { match std::path::absolute(p) { Ok(p) => p.strip_prefix(&builder.src).unwrap_or(&p).to_path_buf(), Err(e) => { - eprintln!("ERROR: {:?}", e); - panic!("Due to the above error, failed to resolve path: {:?}", p); + eprintln!("ERROR: {e:?}"); + panic!("Due to the above error, failed to resolve path: {p:?}"); } } }) @@ -694,8 +694,7 @@ impl<'a> ShouldRun<'a> { if !submodules_paths.iter().any(|sm_p| p.contains(sm_p)) { assert!( self.builder.src.join(p).exists(), - "`should_run.paths` should correspond to real on-disk paths - use `alias` if there is no relevant path: {}", - p + "`should_run.paths` should correspond to real on-disk paths - use `alias` if there is no relevant path: {p}" ); } diff --git a/src/bootstrap/src/core/config/config.rs b/src/bootstrap/src/core/config/config.rs index 65a3e7667e7..c8beca25bcc 100644 --- a/src/bootstrap/src/core/config/config.rs +++ b/src/bootstrap/src/core/config/config.rs @@ -3042,7 +3042,7 @@ impl Config { let actual_hash = recorded .split_whitespace() .nth(2) - .unwrap_or_else(|| panic!("unexpected output `{}`", recorded)); + .unwrap_or_else(|| panic!("unexpected output `{recorded}`")); if actual_hash == checked_out_hash { // already checked out @@ -3297,7 +3297,7 @@ impl Config { } StringOrBool::String(s) if s == "if-unchanged" => if_unchanged(), StringOrBool::String(other) => { - panic!("unrecognized option for download-ci-llvm: {:?}", other) + panic!("unrecognized option for download-ci-llvm: {other:?}") } } } diff --git a/src/bootstrap/src/core/download.rs b/src/bootstrap/src/core/download.rs index da305fb18fa..64298964dad 100644 --- a/src/bootstrap/src/core/download.rs +++ b/src/bootstrap/src/core/download.rs @@ -57,7 +57,7 @@ impl Config { if self.dry_run() { return; } - fs::remove_file(f).unwrap_or_else(|_| panic!("failed to remove {:?}", f)); + fs::remove_file(f).unwrap_or_else(|_| panic!("failed to remove {f:?}")); } /// Create a temporary directory in `out` and return its path. @@ -112,7 +112,7 @@ impl Config { // The latter one does not exist on NixOS when using tmpfs as root. let is_nixos = match File::open("/etc/os-release") { Err(e) if e.kind() == ErrorKind::NotFound => false, - Err(e) => panic!("failed to access /etc/os-release: {}", e), + Err(e) => panic!("failed to access /etc/os-release: {e}"), Ok(os_release) => BufReader::new(os_release).lines().any(|l| { let l = l.expect("reading /etc/os-release"); matches!(l.trim(), "ID=nixos" | "ID='nixos'" | "ID=\"nixos\"") diff --git a/src/bootstrap/src/core/sanity.rs b/src/bootstrap/src/core/sanity.rs index 4b020a7edb7..eb7e3799a68 100644 --- a/src/bootstrap/src/core/sanity.rs +++ b/src/bootstrap/src/core/sanity.rs @@ -117,8 +117,8 @@ pub fn check(build: &mut Build) { eprintln!( "\nYour system's libstdc++ version is too old for the `llvm.download-ci-llvm` option." ); - eprintln!("Current version detected: '{}'", version); - eprintln!("Minimum required version: '{}'", LIBSTDCXX_MIN_VERSION_THRESHOLD); + eprintln!("Current version detected: '{version}'"); + eprintln!("Minimum required version: '{LIBSTDCXX_MIN_VERSION_THRESHOLD}'"); eprintln!( "Consider upgrading libstdc++ or disabling the `llvm.download-ci-llvm` option." ); diff --git a/src/bootstrap/src/utils/helpers.rs b/src/bootstrap/src/utils/helpers.rs index b31b2757767..b29c1fb3889 100644 --- a/src/bootstrap/src/utils/helpers.rs +++ b/src/bootstrap/src/utils/helpers.rs @@ -329,7 +329,7 @@ pub fn start_process(cmd: &mut Command) -> impl FnOnce() -> String + use<> { Err(e) => fail(&format!("failed to execute command: {cmd:?}\nERROR: {e}")), }; - let command = format!("{:?}", cmd); + let command = format!("{cmd:?}"); move || { let output = child.wait_with_output().unwrap(); @@ -540,7 +540,7 @@ where use std::fmt::Write; input.as_ref().iter().fold(String::with_capacity(input.as_ref().len() * 2), |mut acc, &byte| { - write!(&mut acc, "{:02x}", byte).expect("Failed to write byte to the hex String."); + write!(&mut acc, "{byte:02x}").expect("Failed to write byte to the hex String."); acc }) } diff --git a/src/bootstrap/src/utils/shared_helpers.rs b/src/bootstrap/src/utils/shared_helpers.rs index 7b206c3ffe8..1297a53d488 100644 --- a/src/bootstrap/src/utils/shared_helpers.rs +++ b/src/bootstrap/src/utils/shared_helpers.rs @@ -90,7 +90,7 @@ pub fn maybe_dump(dump_name: String, cmd: &Command) { let mut file = OpenOptions::new().create(true).append(true).open(dump_file).unwrap(); - let cmd_dump = format!("{:?}\n", cmd); + let cmd_dump = format!("{cmd:?}\n"); let cmd_dump = cmd_dump.replace(&env::var("BUILD_OUT").unwrap(), "${BUILD_OUT}"); let cmd_dump = cmd_dump.replace(&env::var("CARGO_HOME").unwrap(), "${CARGO_HOME}"); |
