about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2024-07-29 02:43:41 +0000
committerbors <bors@rust-lang.org>2024-07-29 02:43:41 +0000
commit2e630267b2bce50af3258ce4817e377fa09c145b (patch)
tree29006db815bf547dfd0129910b23b8c54675bd98 /src
parent2cbbe8b8bb2be672b14cf741a2f0ec24a49f3f0b (diff)
parent84ac80f1921afc243d71fd0caaa4f2838c294102 (diff)
Auto merge of #125443 - nnethercote:rustfmt-use-decls, r=lcnr,cuviper,GuillaumeGomez
rustfmt `use` declarations

This PR implements https://github.com/rust-lang/compiler-team/issues/750, which changes how `use` declarations are formatted by adding these options to `rustfmt.toml`:
```
group_imports = "StdExternalCrate"
imports_granularity = "Module"
```

r? `@ghost`
Diffstat (limited to 'src')
-rw-r--r--src/bootstrap/src/bin/main.rs10
-rw-r--r--src/bootstrap/src/bin/rustc.rs10
-rw-r--r--src/bootstrap/src/core/build_steps/check.rs3
-rw-r--r--src/bootstrap/src/core/build_steps/clippy.rs26
-rw-r--r--src/bootstrap/src/core/build_steps/compile.rs16
-rw-r--r--src/bootstrap/src/core/build_steps/dist.rs6
-rw-r--r--src/bootstrap/src/core/build_steps/doc.rs5
-rw-r--r--src/bootstrap/src/core/build_steps/format.rs14
-rw-r--r--src/bootstrap/src/core/build_steps/install.rs3
-rw-r--r--src/bootstrap/src/core/build_steps/llvm.rs9
-rw-r--r--src/bootstrap/src/core/build_steps/setup.rs15
-rw-r--r--src/bootstrap/src/core/build_steps/setup/tests.rs3
-rw-r--r--src/bootstrap/src/core/build_steps/suggest.rs3
-rw-r--r--src/bootstrap/src/core/build_steps/test.rs19
-rw-r--r--src/bootstrap/src/core/build_steps/tool.rs7
-rw-r--r--src/bootstrap/src/core/build_steps/toolstate.rs13
-rw-r--r--src/bootstrap/src/core/build_steps/vendor.rs3
-rw-r--r--src/bootstrap/src/core/builder.rs20
-rw-r--r--src/bootstrap/src/core/builder/tests.rs9
-rw-r--r--src/bootstrap/src/core/config/config.rs16
-rw-r--r--src/bootstrap/src/core/config/tests.rs20
-rw-r--r--src/bootstrap/src/core/download.rs19
-rw-r--r--src/bootstrap/src/core/sanity.rs10
-rw-r--r--src/bootstrap/src/lib.rs9
-rw-r--r--src/bootstrap/src/utils/cache.rs3
-rw-r--r--src/bootstrap/src/utils/channel.rs3
-rw-r--r--src/bootstrap/src/utils/exec.rs8
-rw-r--r--src/bootstrap/src/utils/helpers.rs16
-rw-r--r--src/bootstrap/src/utils/helpers/tests.rs17
-rw-r--r--src/bootstrap/src/utils/job.rs33
-rw-r--r--src/bootstrap/src/utils/metrics.rs16
-rw-r--r--src/bootstrap/src/utils/render_tests.rs6
-rw-r--r--src/bootstrap/src/utils/tarball.rs4
-rw-r--r--src/ci/docker/host-x86_64/test-various/uefi_qemu_test/src/main.rs1
-rw-r--r--src/librustdoc/clean/auto_trait.rs6
-rw-r--r--src/librustdoc/clean/blanket_impl.rs1
-rw-r--r--src/librustdoc/clean/cfg.rs4
-rw-r--r--src/librustdoc/clean/cfg/tests.rs7
-rw-r--r--src/librustdoc/clean/inline.rs9
-rw-r--r--src/librustdoc/clean/mod.rs27
-rw-r--r--src/librustdoc/clean/simplify.rs3
-rw-r--r--src/librustdoc/clean/types.rs25
-rw-r--r--src/librustdoc/clean/types/tests.rs4
-rw-r--r--src/librustdoc/clean/utils.rs31
-rw-r--r--src/librustdoc/config.rs20
-rw-r--r--src/librustdoc/core.rs25
-rw-r--r--src/librustdoc/docfs.rs4
-rw-r--r--src/librustdoc/doctest.rs22
-rw-r--r--src/librustdoc/doctest/rust.rs6
-rw-r--r--src/librustdoc/doctest/tests.rs3
-rw-r--r--src/librustdoc/externalfiles.rs10
-rw-r--r--src/librustdoc/formats/cache.rs3
-rw-r--r--src/librustdoc/formats/item_type.rs3
-rw-r--r--src/librustdoc/formats/mod.rs3
-rw-r--r--src/librustdoc/html/format.rs16
-rw-r--r--src/librustdoc/html/highlight.rs7
-rw-r--r--src/librustdoc/html/highlight/tests.rs5
-rw-r--r--src/librustdoc/html/layout.rs6
-rw-r--r--src/librustdoc/html/markdown.rs27
-rw-r--r--src/librustdoc/html/markdown/tests.rs8
-rw-r--r--src/librustdoc/html/render/context.rs13
-rw-r--r--src/librustdoc/html/render/mod.rs20
-rw-r--r--src/librustdoc/html/render/print_item.rs14
-rw-r--r--src/librustdoc/html/render/search_index.rs3
-rw-r--r--src/librustdoc/html/render/sidebar.rs17
-rw-r--r--src/librustdoc/html/render/span_map.rs6
-rw-r--r--src/librustdoc/html/render/type_layout.rs8
-rw-r--r--src/librustdoc/html/sources.rs29
-rw-r--r--src/librustdoc/html/static_files.rs3
-rw-r--r--src/librustdoc/html/tests.rs3
-rw-r--r--src/librustdoc/json/conversions.rs4
-rw-r--r--src/librustdoc/json/import_finder.rs6
-rw-r--r--src/librustdoc/json/mod.rs1
-rw-r--r--src/librustdoc/lib.rs3
-rw-r--r--src/librustdoc/lint.rs4
-rw-r--r--src/librustdoc/passes/calculate_doc_coverage.rs17
-rw-r--r--src/librustdoc/passes/check_doc_test_visibility.rs7
-rw-r--r--src/librustdoc/passes/collect_intra_doc_links.rs24
-rw-r--r--src/librustdoc/passes/collect_trait_impls.rs10
-rw-r--r--src/librustdoc/passes/lint/bare_urls.rs12
-rw-r--r--src/librustdoc/passes/lint/check_code_block_syntax.rs8
-rw-r--r--src/librustdoc/passes/lint/html_tags.rs12
-rw-r--r--src/librustdoc/passes/lint/redundant_explicit_links.rs3
-rw-r--r--src/librustdoc/passes/lint/unescaped_backticks.rs10
-rw-r--r--src/librustdoc/passes/lint/unportable_markdown.rs11
-rw-r--r--src/librustdoc/passes/propagate_doc_cfg.rs4
-rw-r--r--src/librustdoc/passes/strip_aliased_non_local.rs3
-rw-r--r--src/librustdoc/passes/strip_hidden.rs3
-rw-r--r--src/librustdoc/passes/stripper.rs3
-rw-r--r--src/librustdoc/scrape_examples.rs32
-rw-r--r--src/librustdoc/theme.rs2
-rw-r--r--src/librustdoc/visit_ast.rs7
-rw-r--r--src/librustdoc/visit_lib.rs3
-rw-r--r--src/rustdoc-json-types/lib.rs3
-rw-r--r--src/tools/build-manifest/src/checksum.rs8
-rw-r--r--src/tools/build-manifest/src/main.rs8
-rw-r--r--src/tools/build-manifest/src/manifest.rs8
-rw-r--r--src/tools/build-manifest/src/versions.rs8
-rw-r--r--src/tools/build_helper/src/git.rs4
-rw-r--r--src/tools/bump-stage0/src/main.rs3
-rw-r--r--src/tools/cargotest/main.rs3
-rw-r--r--src/tools/collect-license-metadata/src/main.rs6
-rw-r--r--src/tools/collect-license-metadata/src/path_tree.rs3
-rw-r--r--src/tools/collect-license-metadata/src/reuse.rs6
-rw-r--r--src/tools/compiletest/src/common.rs11
-rw-r--r--src/tools/compiletest/src/errors.rs4
-rw-r--r--src/tools/compiletest/src/header.rs3
-rw-r--r--src/tools/compiletest/src/header/cfg.rs3
-rw-r--r--src/tools/compiletest/src/header/tests.rs3
-rw-r--r--src/tools/compiletest/src/json.rs8
-rw-r--r--src/tools/compiletest/src/lib.rs16
-rw-r--r--src/tools/compiletest/src/main.rs7
-rw-r--r--src/tools/compiletest/src/raise_fd_limit.rs3
-rw-r--r--src/tools/compiletest/src/read2.rs9
-rw-r--r--src/tools/compiletest/src/runtest.rs44
-rw-r--r--src/tools/compiletest/src/runtest/debugger.rs8
-rw-r--r--src/tools/compiletest/src/util.rs3
-rw-r--r--src/tools/coverage-dump/src/covfun.rs8
-rw-r--r--src/tools/coverage-dump/src/parser.rs3
-rw-r--r--src/tools/coverage-dump/src/prf_names.rs8
-rw-r--r--src/tools/error_index_generator/main.rs6
-rw-r--r--src/tools/generate-copyright/src/main.rs3
-rw-r--r--src/tools/generate-windows-sys/src/main.rs3
-rw-r--r--src/tools/html-checker/main.rs3
-rw-r--r--src/tools/jsondocck/src/cache.rs5
-rw-r--r--src/tools/jsondocck/src/error.rs3
-rw-r--r--src/tools/jsondocck/src/main.rs7
-rw-r--r--src/tools/jsondoclint/src/validator.rs3
-rw-r--r--src/tools/jsondoclint/src/validator/tests.rs3
-rw-r--r--src/tools/linkchecker/main.rs12
-rw-r--r--src/tools/lint-docs/src/groups.rs3
-rw-r--r--src/tools/lint-docs/src/lib.rs1
-rw-r--r--src/tools/lld-wrapper/src/main.rs3
-rw-r--r--src/tools/llvm-bitcode-linker/src/bin/llvm-bitcode-linker.rs1
-rw-r--r--src/tools/llvm-bitcode-linker/src/linker.rs3
-rw-r--r--src/tools/llvm-bitcode-linker/src/opt.rs3
-rw-r--r--src/tools/opt-dist/src/bolt.rs3
-rw-r--r--src/tools/opt-dist/src/exec.rs10
-rw-r--r--src/tools/opt-dist/src/main.rs2
-rw-r--r--src/tools/opt-dist/src/metrics.rs6
-rw-r--r--src/tools/opt-dist/src/tests.rs5
-rw-r--r--src/tools/opt-dist/src/training.rs9
-rw-r--r--src/tools/opt-dist/src/utils/artifact_size.rs4
-rw-r--r--src/tools/opt-dist/src/utils/io.rs5
-rw-r--r--src/tools/opt-dist/src/utils/mod.rs5
-rw-r--r--src/tools/remote-test-client/src/main.rs3
-rw-r--r--src/tools/remote-test-server/src/main.rs13
-rw-r--r--src/tools/replace-version-placeholder/src/main.rs1
-rw-r--r--src/tools/rls/src/main.rs6
-rw-r--r--src/tools/run-make-support/src/command.rs7
-rw-r--r--src/tools/run-make-support/src/diff/mod.rs3
-rw-r--r--src/tools/run-make-support/src/external_deps/cc.rs5
-rw-r--r--src/tools/run-make-support/src/external_deps/htmldocck.rs3
-rw-r--r--src/tools/run-make-support/src/run.rs3
-rw-r--r--src/tools/rust-installer/src/combiner.rs13
-rw-r--r--src/tools/rust-installer/src/compression.rs12
-rw-r--r--src/tools/rust-installer/src/generator.rs11
-rw-r--r--src/tools/rust-installer/src/scripter.rs6
-rw-r--r--src/tools/rust-installer/src/tarballer.rs9
-rw-r--r--src/tools/rust-installer/src/util.rs15
-rw-r--r--src/tools/rustbook/src/main.rs6
-rw-r--r--src/tools/rustc-perf-wrapper/src/main.rs6
-rw-r--r--src/tools/rustdoc-gui-test/src/config.rs4
-rw-r--r--src/tools/rustdoc-gui-test/src/main.rs7
-rw-r--r--src/tools/suggest-tests/src/lib.rs6
-rw-r--r--src/tools/suggest-tests/src/static_suggestions.rs3
-rw-r--r--src/tools/tidy/src/alphabetical/tests.rs3
-rw-r--r--src/tools/tidy/src/bins.rs3
-rw-r--r--src/tools/tidy/src/debug_artifacts.rs3
-rw-r--r--src/tools/tidy/src/deps.rs5
-rw-r--r--src/tools/tidy/src/edition.rs3
-rw-r--r--src/tools/tidy/src/error_codes.rs4
-rw-r--r--src/tools/tidy/src/ext_tool_checks.rs4
-rw-r--r--src/tools/tidy/src/features.rs6
-rw-r--r--src/tools/tidy/src/fluent_alphabetical.rs7
-rw-r--r--src/tools/tidy/src/fluent_period.rs3
-rw-r--r--src/tools/tidy/src/fluent_used.rs3
-rw-r--r--src/tools/tidy/src/known_bug.rs3
-rw-r--r--src/tools/tidy/src/lib.rs1
-rw-r--r--src/tools/tidy/src/main.rs7
-rw-r--r--src/tools/tidy/src/mir_opt_tests.rs3
-rw-r--r--src/tools/tidy/src/pal.rs3
-rw-r--r--src/tools/tidy/src/style.rs8
-rw-r--r--src/tools/tidy/src/target_policy.rs4
-rw-r--r--src/tools/tidy/src/ui_tests.rs3
-rw-r--r--src/tools/tidy/src/unit_tests.rs3
-rw-r--r--src/tools/tidy/src/unstable_book.rs3
-rw-r--r--src/tools/tidy/src/walk.rs7
-rw-r--r--src/tools/tidy/src/x_version.rs3
-rw-r--r--src/tools/unicode-table-generator/src/cascading_map.rs5
-rw-r--r--src/tools/unicode-table-generator/src/case_mapping.rs9
-rw-r--r--src/tools/unicode-table-generator/src/main.rs1
-rw-r--r--src/tools/unicode-table-generator/src/raw_emitter.rs3
-rw-r--r--src/tools/unicode-table-generator/src/skiplist.rs5
-rw-r--r--src/tools/unicode-table-generator/src/unicode_download.rs3
-rw-r--r--src/tools/unstable-book-gen/src/main.rs1
-rw-r--r--src/tools/x/src/main.rs11
197 files changed, 753 insertions, 796 deletions
diff --git a/src/bootstrap/src/bin/main.rs b/src/bootstrap/src/bin/main.rs
index a7d21ba6ae1..6a386732029 100644
--- a/src/bootstrap/src/bin/main.rs
+++ b/src/bootstrap/src/bin/main.rs
@@ -5,14 +5,10 @@
 //! parent directory, and otherwise documentation can be found throughout the `build`
 //! directory in each respective module.
 
-use std::io::Write;
-use std::process;
+use std::fs::{self, OpenOptions};
+use std::io::{self, BufRead, BufReader, IsTerminal, Write};
 use std::str::FromStr;
-use std::{
-    env,
-    fs::{self, OpenOptions},
-    io::{self, BufRead, BufReader, IsTerminal},
-};
+use std::{env, process};
 
 use bootstrap::{
     find_recent_config_change_ids, human_readable_changes, t, Build, Config, Subcommand,
diff --git a/src/bootstrap/src/bin/rustc.rs b/src/bootstrap/src/bin/rustc.rs
index 46e845f77ae..011c289d932 100644
--- a/src/bootstrap/src/bin/rustc.rs
+++ b/src/bootstrap/src/bin/rustc.rs
@@ -315,12 +315,10 @@ fn format_rusage_data(_child: Child) -> Option<String> {
 fn format_rusage_data(child: Child) -> Option<String> {
     use std::os::windows::io::AsRawHandle;
 
-    use windows::{
-        Win32::Foundation::HANDLE,
-        Win32::System::ProcessStatus::{K32GetProcessMemoryInfo, PROCESS_MEMORY_COUNTERS},
-        Win32::System::Threading::GetProcessTimes,
-        Win32::System::Time::FileTimeToSystemTime,
-    };
+    use windows::Win32::Foundation::HANDLE;
+    use windows::Win32::System::ProcessStatus::{K32GetProcessMemoryInfo, PROCESS_MEMORY_COUNTERS};
+    use windows::Win32::System::Threading::GetProcessTimes;
+    use windows::Win32::System::Time::FileTimeToSystemTime;
 
     let handle = HANDLE(child.as_raw_handle() as isize);
 
diff --git a/src/bootstrap/src/core/build_steps/check.rs b/src/bootstrap/src/core/build_steps/check.rs
index 3e0bb2884cd..1a9aa0c51b6 100644
--- a/src/bootstrap/src/core/build_steps/check.rs
+++ b/src/bootstrap/src/core/build_steps/check.rs
@@ -1,5 +1,7 @@
 //! Implementation of compiling the compiler and standard library, in "check"-based modes.
 
+use std::path::PathBuf;
+
 use crate::core::build_steps::compile::{
     add_to_sysroot, run_cargo, rustc_cargo, rustc_cargo_env, std_cargo,
 };
@@ -9,7 +11,6 @@ use crate::core::builder::{
 };
 use crate::core::config::TargetSelection;
 use crate::{Compiler, Mode, Subcommand};
-use std::path::PathBuf;
 
 pub fn cargo_subcommand(kind: Kind) -> &'static str {
     match kind {
diff --git a/src/bootstrap/src/core/build_steps/clippy.rs b/src/bootstrap/src/core/build_steps/clippy.rs
index 68abf1e464a..c24840dc23c 100644
--- a/src/bootstrap/src/core/build_steps/clippy.rs
+++ b/src/bootstrap/src/core/build_steps/clippy.rs
@@ -1,26 +1,12 @@
 //! Implementation of running clippy on the compiler, standard library and various tools.
 
-use crate::builder::Builder;
-use crate::builder::ShouldRun;
+use super::compile::{librustc_stamp, libstd_stamp, run_cargo, rustc_cargo, std_cargo};
+use super::tool::{prepare_tool_cargo, SourceType};
+use super::{check, compile};
+use crate::builder::{Builder, ShouldRun};
 use crate::core::builder;
-use crate::core::builder::crate_description;
-use crate::core::builder::Alias;
-use crate::core::builder::Kind;
-use crate::core::builder::RunConfig;
-use crate::core::builder::Step;
-use crate::Mode;
-use crate::Subcommand;
-use crate::TargetSelection;
-
-use super::check;
-use super::compile;
-use super::compile::librustc_stamp;
-use super::compile::libstd_stamp;
-use super::compile::run_cargo;
-use super::compile::rustc_cargo;
-use super::compile::std_cargo;
-use super::tool::prepare_tool_cargo;
-use super::tool::SourceType;
+use crate::core::builder::{crate_description, Alias, Kind, RunConfig, Step};
+use crate::{Mode, Subcommand, TargetSelection};
 
 /// Disable the most spammy clippy lints
 const IGNORED_RULES_FOR_STD_AND_RUSTC: &[&str] = &[
diff --git a/src/bootstrap/src/core/build_steps/compile.rs b/src/bootstrap/src/core/build_steps/compile.rs
index 23d1e0ffe2d..ca0364b8ed5 100644
--- a/src/bootstrap/src/core/build_steps/compile.rs
+++ b/src/bootstrap/src/core/build_steps/compile.rs
@@ -8,31 +8,27 @@
 
 use std::borrow::Cow;
 use std::collections::HashSet;
-use std::env;
 use std::ffi::OsStr;
-use std::fs;
 use std::io::prelude::*;
 use std::io::BufReader;
 use std::path::{Path, PathBuf};
 use std::process::Stdio;
-use std::str;
+use std::{env, fs, str};
 
 use serde_derive::Deserialize;
 
-use crate::core::build_steps::dist;
-use crate::core::build_steps::llvm;
 use crate::core::build_steps::tool::SourceType;
+use crate::core::build_steps::{dist, llvm};
 use crate::core::builder;
-use crate::core::builder::crate_description;
-use crate::core::builder::Cargo;
-use crate::core::builder::{Builder, Kind, PathSet, RunConfig, ShouldRun, Step, TaskPath};
+use crate::core::builder::{
+    crate_description, Builder, Cargo, Kind, PathSet, RunConfig, ShouldRun, Step, TaskPath,
+};
 use crate::core::config::{DebuginfoLevel, LlvmLibunwind, RustcLto, TargetSelection};
 use crate::utils::exec::command;
 use crate::utils::helpers::{
     exe, get_clang_cl_resource_dir, is_debug_info, is_dylib, symlink_dir, t, up_to_date,
 };
-use crate::LLVM_TOOLS;
-use crate::{CLang, Compiler, DependencyType, GitRepo, Mode};
+use crate::{CLang, Compiler, DependencyType, GitRepo, Mode, LLVM_TOOLS};
 
 #[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
 pub struct Std {
diff --git a/src/bootstrap/src/core/build_steps/dist.rs b/src/bootstrap/src/core/build_steps/dist.rs
index cd0661e0edd..f971bf115ee 100644
--- a/src/bootstrap/src/core/build_steps/dist.rs
+++ b/src/bootstrap/src/core/build_steps/dist.rs
@@ -9,19 +9,17 @@
 //! pieces of `rustup.rs`!
 
 use std::collections::HashSet;
-use std::env;
 use std::ffi::OsStr;
-use std::fs;
 use std::io::Write;
 use std::path::{Path, PathBuf};
+use std::{env, fs};
 
 use object::read::archive::ArchiveFile;
 use object::BinaryFormat;
 
-use crate::core::build_steps::compile;
 use crate::core::build_steps::doc::DocumentationFormat;
-use crate::core::build_steps::llvm;
 use crate::core::build_steps::tool::{self, Tool};
+use crate::core::build_steps::{compile, llvm};
 use crate::core::builder::{Builder, Kind, RunConfig, ShouldRun, Step};
 use crate::core::config::TargetSelection;
 use crate::utils::channel::{self, Info};
diff --git a/src/bootstrap/src/core/build_steps/doc.rs b/src/bootstrap/src/core/build_steps/doc.rs
index bdd48fa644a..f83dfcad9ec 100644
--- a/src/bootstrap/src/core/build_steps/doc.rs
+++ b/src/bootstrap/src/core/build_steps/doc.rs
@@ -13,8 +13,9 @@ use std::{env, fs, mem};
 
 use crate::core::build_steps::compile;
 use crate::core::build_steps::tool::{self, prepare_tool_cargo, SourceType, Tool};
-use crate::core::builder::{self, crate_description};
-use crate::core::builder::{Alias, Builder, Compiler, Kind, RunConfig, ShouldRun, Step};
+use crate::core::builder::{
+    self, crate_description, Alias, Builder, Compiler, Kind, RunConfig, ShouldRun, Step,
+};
 use crate::core::config::{Config, TargetSelection};
 use crate::utils::helpers::{symlink_dir, t, up_to_date};
 use crate::Mode;
diff --git a/src/bootstrap/src/core/build_steps/format.rs b/src/bootstrap/src/core/build_steps/format.rs
index f254c058b12..8c52df78ab6 100644
--- a/src/bootstrap/src/core/build_steps/format.rs
+++ b/src/bootstrap/src/core/build_steps/format.rs
@@ -1,17 +1,19 @@
 //! Runs rustfmt on the repository.
 
-use crate::core::builder::Builder;
-use crate::utils::exec::command;
-use crate::utils::helpers::{self, program_out_of_date, t};
-use build_helper::ci::CiEnv;
-use build_helper::git::get_git_modified_files;
-use ignore::WalkBuilder;
 use std::collections::VecDeque;
 use std::path::{Path, PathBuf};
 use std::process::Command;
 use std::sync::mpsc::SyncSender;
 use std::sync::Mutex;
 
+use build_helper::ci::CiEnv;
+use build_helper::git::get_git_modified_files;
+use ignore::WalkBuilder;
+
+use crate::core::builder::Builder;
+use crate::utils::exec::command;
+use crate::utils::helpers::{self, program_out_of_date, t};
+
 fn rustfmt(src: &Path, rustfmt: &Path, paths: &[PathBuf], check: bool) -> impl FnMut(bool) -> bool {
     let mut cmd = Command::new(rustfmt);
     // Avoid the submodule config paths from coming into play. We only allow a single global config
diff --git a/src/bootstrap/src/core/build_steps/install.rs b/src/bootstrap/src/core/build_steps/install.rs
index d3e9d6d7875..0ce86eadbce 100644
--- a/src/bootstrap/src/core/build_steps/install.rs
+++ b/src/bootstrap/src/core/build_steps/install.rs
@@ -3,9 +3,8 @@
 //! This module is responsible for installing the standard library,
 //! compiler, and documentation.
 
-use std::env;
-use std::fs;
 use std::path::{Component, Path, PathBuf};
+use std::{env, fs};
 
 use crate::core::build_steps::dist;
 use crate::core::builder::{Builder, RunConfig, ShouldRun, Step};
diff --git a/src/bootstrap/src/core/build_steps/llvm.rs b/src/bootstrap/src/core/build_steps/llvm.rs
index 92a7ffc3a98..81e591be699 100644
--- a/src/bootstrap/src/core/build_steps/llvm.rs
+++ b/src/bootstrap/src/core/build_steps/llvm.rs
@@ -8,25 +8,24 @@
 //! LLVM and compiler-rt are essentially just wired up to everything else to
 //! ensure that they're always in place if needed.
 
-use std::env;
 use std::env::consts::EXE_EXTENSION;
 use std::ffi::{OsStr, OsString};
 use std::fs::{self, File};
-use std::io;
 use std::path::{Path, PathBuf};
 use std::sync::OnceLock;
+use std::{env, io};
+
+use build_helper::ci::CiEnv;
 
 use crate::core::builder::{Builder, RunConfig, ShouldRun, Step};
 use crate::core::config::{Config, TargetSelection};
 use crate::utils::channel;
+use crate::utils::exec::command;
 use crate::utils::helpers::{
     self, exe, get_clang_cl_resource_dir, output, t, unhashed_basename, up_to_date,
 };
 use crate::{generate_smart_stamp_hash, CLang, GitRepo, Kind};
 
-use crate::utils::exec::command;
-use build_helper::ci::CiEnv;
-
 #[derive(Clone)]
 pub struct LlvmResult {
     /// Path to llvm-config binary.
diff --git a/src/bootstrap/src/core/build_steps/setup.rs b/src/bootstrap/src/core/build_steps/setup.rs
index 7da91b83895..8cd9ba5fd14 100644
--- a/src/bootstrap/src/core/build_steps/setup.rs
+++ b/src/bootstrap/src/core/build_steps/setup.rs
@@ -5,13 +5,6 @@
 //! allows setting up things that cannot be simply captured inside the config.toml, in addition to
 //! leading people away from manually editing most of the config.toml values.
 
-use crate::core::builder::{Builder, RunConfig, ShouldRun, Step};
-use crate::t;
-use crate::utils::change_tracker::CONFIG_CHANGE_HISTORY;
-use crate::utils::exec::command;
-use crate::utils::helpers::{self, hex_encode};
-use crate::Config;
-use sha2::Digest;
 use std::env::consts::EXE_SUFFIX;
 use std::fmt::Write as _;
 use std::fs::File;
@@ -20,6 +13,14 @@ use std::path::{Path, PathBuf, MAIN_SEPARATOR_STR};
 use std::str::FromStr;
 use std::{fmt, fs, io};
 
+use sha2::Digest;
+
+use crate::core::builder::{Builder, RunConfig, ShouldRun, Step};
+use crate::utils::change_tracker::CONFIG_CHANGE_HISTORY;
+use crate::utils::exec::command;
+use crate::utils::helpers::{self, hex_encode};
+use crate::{t, Config};
+
 #[cfg(test)]
 mod tests;
 
diff --git a/src/bootstrap/src/core/build_steps/setup/tests.rs b/src/bootstrap/src/core/build_steps/setup/tests.rs
index 3e4d66c7454..3552224f33b 100644
--- a/src/bootstrap/src/core/build_steps/setup/tests.rs
+++ b/src/bootstrap/src/core/build_steps/setup/tests.rs
@@ -1,6 +1,7 @@
+use sha2::Digest;
+
 use super::{RUST_ANALYZER_SETTINGS, SETTINGS_HASHES};
 use crate::utils::helpers::hex_encode;
-use sha2::Digest;
 
 #[test]
 fn check_matching_settings_hash() {
diff --git a/src/bootstrap/src/core/build_steps/suggest.rs b/src/bootstrap/src/core/build_steps/suggest.rs
index 0f4765fc121..8aaffab514d 100644
--- a/src/bootstrap/src/core/build_steps/suggest.rs
+++ b/src/bootstrap/src/core/build_steps/suggest.rs
@@ -2,10 +2,11 @@
 
 #![cfg_attr(feature = "build-metrics", allow(unused))]
 
-use clap::Parser;
 use std::path::PathBuf;
 use std::str::FromStr;
 
+use clap::Parser;
+
 use crate::core::build_steps::tool::Tool;
 use crate::core::builder::Builder;
 
diff --git a/src/bootstrap/src/core/build_steps/test.rs b/src/bootstrap/src/core/build_steps/test.rs
index 4942a4939af..16425ba9f7c 100644
--- a/src/bootstrap/src/core/build_steps/test.rs
+++ b/src/bootstrap/src/core/build_steps/test.rs
@@ -3,27 +3,22 @@
 //! `./x.py test` (aka [`Kind::Test`]) is currently allowed to reach build steps in other modules.
 //! However, this contains ~all test parts we expect people to be able to build and run locally.
 
-use std::env;
-use std::ffi::OsStr;
-use std::ffi::OsString;
-use std::fs;
-use std::iter;
+use std::ffi::{OsStr, OsString};
 use std::path::{Path, PathBuf};
+use std::{env, fs, iter};
 
 use clap_complete::shells;
 
-use crate::core::build_steps::compile;
-use crate::core::build_steps::dist;
 use crate::core::build_steps::doc::DocumentationFormat;
-use crate::core::build_steps::llvm;
 use crate::core::build_steps::synthetic_targets::MirOptPanicAbortSyntheticTarget;
 use crate::core::build_steps::tool::{self, SourceType, Tool};
 use crate::core::build_steps::toolstate::ToolState;
+use crate::core::build_steps::{compile, dist, llvm};
 use crate::core::builder;
-use crate::core::builder::crate_description;
-use crate::core::builder::{Builder, Compiler, Kind, RunConfig, ShouldRun, Step};
-use crate::core::config::flags::get_completion;
-use crate::core::config::flags::Subcommand;
+use crate::core::builder::{
+    crate_description, Builder, Compiler, Kind, RunConfig, ShouldRun, Step,
+};
+use crate::core::config::flags::{get_completion, Subcommand};
 use crate::core::config::TargetSelection;
 use crate::utils::exec::{command, BootstrapCommand};
 use crate::utils::helpers::{
diff --git a/src/bootstrap/src/core/build_steps/tool.rs b/src/bootstrap/src/core/build_steps/tool.rs
index a059cc15182..147193061c8 100644
--- a/src/bootstrap/src/core/build_steps/tool.rs
+++ b/src/bootstrap/src/core/build_steps/tool.rs
@@ -1,6 +1,5 @@
-use std::env;
-use std::fs;
 use std::path::PathBuf;
+use std::{env, fs};
 
 use crate::core::build_steps::compile;
 use crate::core::build_steps::toolstate::ToolState;
@@ -10,9 +9,7 @@ use crate::core::config::TargetSelection;
 use crate::utils::channel::GitInfo;
 use crate::utils::exec::{command, BootstrapCommand};
 use crate::utils::helpers::{add_dylib_path, exe, get_closest_merge_base_commit, git, t};
-use crate::Compiler;
-use crate::Mode;
-use crate::{gha, Kind};
+use crate::{gha, Compiler, Kind, Mode};
 
 #[derive(Debug, Clone, Hash, PartialEq, Eq)]
 pub enum SourceType {
diff --git a/src/bootstrap/src/core/build_steps/toolstate.rs b/src/bootstrap/src/core/build_steps/toolstate.rs
index 912cd4b8676..b73961062f6 100644
--- a/src/bootstrap/src/core/build_steps/toolstate.rs
+++ b/src/bootstrap/src/core/build_steps/toolstate.rs
@@ -4,16 +4,15 @@
 //!
 //! [Toolstate]: https://forge.rust-lang.org/infra/toolstate.html
 
-use crate::core::builder::{Builder, RunConfig, ShouldRun, Step};
-use crate::utils::helpers::{self, t};
-use serde_derive::{Deserialize, Serialize};
 use std::collections::HashMap;
-use std::env;
-use std::fmt;
-use std::fs;
 use std::io::{Seek, SeekFrom};
 use std::path::{Path, PathBuf};
-use std::time;
+use std::{env, fmt, fs, time};
+
+use serde_derive::{Deserialize, Serialize};
+
+use crate::core::builder::{Builder, RunConfig, ShouldRun, Step};
+use crate::utils::helpers::{self, t};
 
 // Each cycle is 42 days long (6 weeks); the last week is 35..=42 then.
 const BETA_WEEK_START: u64 = 35;
diff --git a/src/bootstrap/src/core/build_steps/vendor.rs b/src/bootstrap/src/core/build_steps/vendor.rs
index 8732b30e940..81770036d71 100644
--- a/src/bootstrap/src/core/build_steps/vendor.rs
+++ b/src/bootstrap/src/core/build_steps/vendor.rs
@@ -1,7 +1,8 @@
+use std::path::PathBuf;
+
 use crate::core::build_steps::tool::SUBMODULES_FOR_RUSTBOOK;
 use crate::core::builder::{Builder, RunConfig, ShouldRun, Step};
 use crate::utils::exec::command;
-use std::path::PathBuf;
 
 #[derive(Debug, Clone, Hash, PartialEq, Eq)]
 pub(crate) struct Vendor {
diff --git a/src/bootstrap/src/core/builder.rs b/src/bootstrap/src/core/builder.rs
index d21ddc5672b..99b5c891403 100644
--- a/src/bootstrap/src/core/builder.rs
+++ b/src/bootstrap/src/core/builder.rs
@@ -1,15 +1,16 @@
 use std::any::{type_name, Any};
 use std::cell::{Cell, RefCell};
 use std::collections::BTreeSet;
-use std::env;
 use std::ffi::{OsStr, OsString};
 use std::fmt::{Debug, Write};
-use std::fs;
 use std::hash::Hash;
 use std::ops::Deref;
 use std::path::{Path, PathBuf};
 use std::sync::LazyLock;
 use std::time::{Duration, Instant};
+use std::{env, fs};
+
+use clap::ValueEnum;
 
 use crate::core::build_steps::tool::{self, SourceType};
 use crate::core::build_steps::{
@@ -17,17 +18,16 @@ use crate::core::build_steps::{
 };
 use crate::core::config::flags::{Color, Subcommand};
 use crate::core::config::{DryRun, SplitDebuginfo, TargetSelection};
-use crate::prepare_behaviour_dump_dir;
 use crate::utils::cache::Cache;
-use crate::utils::helpers::{self, add_dylib_path, add_link_lib_path, exe, linker_args};
-use crate::utils::helpers::{check_cfg_arg, libdir, linker_flags, t, LldThreads};
-use crate::EXTRA_CHECK_CFGS;
-use crate::{Build, CLang, Crate, DocTests, GitRepo, Mode};
-
 use crate::utils::exec::{command, BootstrapCommand};
+use crate::utils::helpers::{
+    self, add_dylib_path, add_link_lib_path, check_cfg_arg, exe, libdir, linker_args, linker_flags,
+    t, LldThreads,
+};
 pub use crate::Compiler;
-
-use clap::ValueEnum;
+use crate::{
+    prepare_behaviour_dump_dir, Build, CLang, Crate, DocTests, GitRepo, Mode, EXTRA_CHECK_CFGS,
+};
 
 #[cfg(test)]
 mod tests;
diff --git a/src/bootstrap/src/core/builder/tests.rs b/src/bootstrap/src/core/builder/tests.rs
index ccabcad243f..a295c89730a 100644
--- a/src/bootstrap/src/core/builder/tests.rs
+++ b/src/bootstrap/src/core/builder/tests.rs
@@ -1,7 +1,8 @@
+use std::thread;
+
 use super::*;
 use crate::core::build_steps::doc::DocumentationFormat;
 use crate::core::config::Config;
-use std::thread;
 
 fn configure(cmd: &str, host: &[&str], target: &[&str]) -> Config {
     configure_with_args(&[cmd.to_owned()], host, target)
@@ -215,10 +216,11 @@ fn alias_and_path_for_library() {
 }
 
 mod defaults {
+    use pretty_assertions::assert_eq;
+
     use super::{configure, first, run_build};
     use crate::core::builder::*;
     use crate::Config;
-    use pretty_assertions::assert_eq;
 
     #[test]
     fn build_default() {
@@ -326,9 +328,10 @@ mod defaults {
 }
 
 mod dist {
+    use pretty_assertions::assert_eq;
+
     use super::{first, run_build, Config};
     use crate::core::builder::*;
-    use pretty_assertions::assert_eq;
 
     fn configure(host: &[&str], target: &[&str]) -> Config {
         Config { stage: 2, ..super::configure("dist", host, target) }
diff --git a/src/bootstrap/src/core/config/config.rs b/src/bootstrap/src/core/config/config.rs
index 3435225af7b..b0a967d756b 100644
--- a/src/bootstrap/src/core/config/config.rs
+++ b/src/bootstrap/src/core/config/config.rs
@@ -4,29 +4,27 @@
 //! how the build runs.
 
 use std::cell::{Cell, RefCell};
-use std::cmp;
 use std::collections::{HashMap, HashSet};
-use std::env;
 use std::fmt::{self, Display};
-use std::fs;
 use std::io::IsTerminal;
 use std::path::{absolute, Path, PathBuf};
 use std::process::Command;
 use std::str::FromStr;
 use std::sync::OnceLock;
+use std::{cmp, env, fs};
+
+use build_helper::exit;
+use build_helper::git::GitConfig;
+use serde::{Deserialize, Deserializer};
+use serde_derive::Deserialize;
 
 use crate::core::build_steps::compile::CODEGEN_BACKEND_PREFIX;
 use crate::core::build_steps::llvm;
+pub use crate::core::config::flags::Subcommand;
 use crate::core::config::flags::{Color, Flags, Warnings};
 use crate::utils::cache::{Interned, INTERNER};
 use crate::utils::channel::{self, GitInfo};
 use crate::utils::helpers::{self, exe, get_closest_merge_base_commit, output, t};
-use build_helper::exit;
-use serde::{Deserialize, Deserializer};
-use serde_derive::Deserialize;
-
-pub use crate::core::config::flags::Subcommand;
-use build_helper::git::GitConfig;
 
 macro_rules! check_ci_llvm {
     ($name:expr) => {
diff --git a/src/bootstrap/src/core/config/tests.rs b/src/bootstrap/src/core/config/tests.rs
index bfb2c02860d..6e695d269cf 100644
--- a/src/bootstrap/src/core/config/tests.rs
+++ b/src/bootstrap/src/core/config/tests.rs
@@ -1,17 +1,15 @@
-use super::{flags::Flags, ChangeIdWrapper, Config};
-use crate::core::build_steps::clippy::get_clippy_rules_in_order;
-use crate::core::config::Target;
-use crate::core::config::TargetSelection;
-use crate::core::config::{LldMode, TomlConfig};
+use std::env;
+use std::fs::{remove_file, File};
+use std::io::Write;
+use std::path::Path;
 
 use clap::CommandFactory;
 use serde::Deserialize;
-use std::{
-    env,
-    fs::{remove_file, File},
-    io::Write,
-    path::Path,
-};
+
+use super::flags::Flags;
+use super::{ChangeIdWrapper, Config};
+use crate::core::build_steps::clippy::get_clippy_rules_in_order;
+use crate::core::config::{LldMode, Target, TargetSelection, TomlConfig};
 
 fn parse(config: &str) -> Config {
     Config::parse_inner(&["check".to_string(), "--config=/does/not/exist".to_string()], |&_| {
diff --git a/src/bootstrap/src/core/download.rs b/src/bootstrap/src/core/download.rs
index 56a8528d0a1..4d1aea3cd95 100644
--- a/src/bootstrap/src/core/download.rs
+++ b/src/bootstrap/src/core/download.rs
@@ -1,19 +1,16 @@
-use std::{
-    env,
-    ffi::OsString,
-    fs::{self, File},
-    io::{BufRead, BufReader, BufWriter, ErrorKind, Write},
-    path::{Path, PathBuf},
-    process::{Command, Stdio},
-    sync::OnceLock,
-};
+use std::env;
+use std::ffi::OsString;
+use std::fs::{self, File};
+use std::io::{BufRead, BufReader, BufWriter, ErrorKind, Write};
+use std::path::{Path, PathBuf};
+use std::process::{Command, Stdio};
+use std::sync::OnceLock;
 
 use build_helper::ci::CiEnv;
 use xz2::bufread::XzDecoder;
 
 use crate::utils::exec::{command, BootstrapCommand};
-use crate::utils::helpers::hex_encode;
-use crate::utils::helpers::{check_run, exe, move_file, program_out_of_date};
+use crate::utils::helpers::{check_run, exe, hex_encode, move_file, program_out_of_date};
 use crate::{t, Config};
 
 static SHOULD_FIX_BINS_AND_DYLIBS: OnceLock<bool> = OnceLock::new();
diff --git a/src/bootstrap/src/core/sanity.rs b/src/bootstrap/src/core/sanity.rs
index 8aa0c43ad6e..45f4090ef22 100644
--- a/src/bootstrap/src/core/sanity.rs
+++ b/src/bootstrap/src/core/sanity.rs
@@ -9,19 +9,17 @@
 //! practice that's likely not true!
 
 use std::collections::HashMap;
-use std::env;
+#[cfg(not(feature = "bootstrap-self-test"))]
+use std::collections::HashSet;
 use std::ffi::{OsStr, OsString};
-use std::fs;
 use std::path::PathBuf;
+use std::{env, fs};
 
 #[cfg(not(feature = "bootstrap-self-test"))]
 use crate::builder::Builder;
+use crate::builder::Kind;
 #[cfg(not(feature = "bootstrap-self-test"))]
 use crate::core::build_steps::tool;
-#[cfg(not(feature = "bootstrap-self-test"))]
-use std::collections::HashSet;
-
-use crate::builder::Kind;
 use crate::core::config::Target;
 use crate::utils::exec::command;
 use crate::Build;
diff --git a/src/bootstrap/src/lib.rs b/src/bootstrap/src/lib.rs
index 43abf10c7e3..d2f5d166718 100644
--- a/src/bootstrap/src/lib.rs
+++ b/src/bootstrap/src/lib.rs
@@ -18,15 +18,13 @@
 
 use std::cell::{Cell, RefCell};
 use std::collections::{HashMap, HashSet};
-use std::env;
 use std::fmt::Display;
 use std::fs::{self, File};
-use std::io;
 use std::path::{Path, PathBuf};
 use std::process::Command;
-use std::str;
 use std::sync::OnceLock;
 use std::time::SystemTime;
+use std::{env, io, str};
 
 use build_helper::ci::{gha, CiEnv};
 use build_helper::exit;
@@ -37,9 +35,7 @@ use utils::helpers::hex_encode;
 
 use crate::core::builder;
 use crate::core::builder::{Builder, Kind};
-use crate::core::config::{flags, LldMode};
-use crate::core::config::{DryRun, Target};
-use crate::core::config::{LlvmLibunwind, TargetSelection};
+use crate::core::config::{flags, DryRun, LldMode, LlvmLibunwind, Target, TargetSelection};
 use crate::utils::exec::{command, BehaviorOnFailure, BootstrapCommand, CommandOutput, OutputMode};
 use crate::utils::helpers::{self, dir_is_empty, exe, libdir, mtime, output, symlink_dir};
 
@@ -49,6 +45,7 @@ mod utils;
 pub use core::builder::PathSet;
 pub use core::config::flags::Subcommand;
 pub use core::config::Config;
+
 pub use utils::change_tracker::{
     find_recent_config_change_ids, human_readable_changes, CONFIG_CHANGE_HISTORY,
 };
diff --git a/src/bootstrap/src/utils/cache.rs b/src/bootstrap/src/utils/cache.rs
index d60b54dc703..3f78b04d44a 100644
--- a/src/bootstrap/src/utils/cache.rs
+++ b/src/bootstrap/src/utils/cache.rs
@@ -3,13 +3,12 @@ use std::borrow::Borrow;
 use std::cell::RefCell;
 use std::cmp::Ordering;
 use std::collections::HashMap;
-use std::fmt;
 use std::hash::{Hash, Hasher};
 use std::marker::PhantomData;
-use std::mem;
 use std::ops::Deref;
 use std::path::PathBuf;
 use std::sync::{LazyLock, Mutex};
+use std::{fmt, mem};
 
 use crate::core::builder::Step;
 
diff --git a/src/bootstrap/src/utils/channel.rs b/src/bootstrap/src/utils/channel.rs
index f8bcb584991..3ae512ef7f1 100644
--- a/src/bootstrap/src/utils/channel.rs
+++ b/src/bootstrap/src/utils/channel.rs
@@ -8,11 +8,10 @@
 use std::fs;
 use std::path::Path;
 
+use super::helpers;
 use crate::utils::helpers::{output, t};
 use crate::Build;
 
-use super::helpers;
-
 #[derive(Clone, Default)]
 pub enum GitInfo {
     /// This is not a git repository.
diff --git a/src/bootstrap/src/utils/exec.rs b/src/bootstrap/src/utils/exec.rs
index 627ea050043..e1387bbbd35 100644
--- a/src/bootstrap/src/utils/exec.rs
+++ b/src/bootstrap/src/utils/exec.rs
@@ -1,11 +1,13 @@
-use crate::Build;
-use build_helper::ci::CiEnv;
-use build_helper::drop_bomb::DropBomb;
 use std::ffi::OsStr;
 use std::fmt::{Debug, Formatter};
 use std::path::Path;
 use std::process::{Command, CommandArgs, CommandEnvs, ExitStatus, Output, Stdio};
 
+use build_helper::ci::CiEnv;
+use build_helper::drop_bomb::DropBomb;
+
+use crate::Build;
+
 /// What should be done when the command fails.
 #[derive(Debug, Copy, Clone)]
 pub enum BehaviorOnFailure {
diff --git a/src/bootstrap/src/utils/helpers.rs b/src/bootstrap/src/utils/helpers.rs
index 51c14ff6282..16959ce7e82 100644
--- a/src/bootstrap/src/utils/helpers.rs
+++ b/src/bootstrap/src/utils/helpers.rs
@@ -3,23 +3,20 @@
 //! Simple things like testing the various filesystem operations here and there,
 //! not a lot of interesting happenings here unfortunately.
 
-use build_helper::git::{get_git_merge_base, output_result, GitConfig};
-use build_helper::util::fail;
-use std::env;
 use std::ffi::OsStr;
-use std::fs;
-use std::io;
 use std::path::{Path, PathBuf};
 use std::process::{Command, Stdio};
-use std::str;
 use std::sync::OnceLock;
 use std::time::{Instant, SystemTime, UNIX_EPOCH};
+use std::{env, fs, io, str};
+
+use build_helper::git::{get_git_merge_base, output_result, GitConfig};
+use build_helper::util::fail;
 
 use crate::core::builder::Builder;
 use crate::core::config::{Config, TargetSelection};
-use crate::LldMode;
-
 pub use crate::utils::shared_helpers::{dylib_path, dylib_path_var};
+use crate::LldMode;
 
 #[cfg(test)]
 mod tests;
@@ -48,9 +45,10 @@ macro_rules! t {
         }
     };
 }
-use crate::utils::exec::{command, BootstrapCommand};
 pub use t;
 
+use crate::utils::exec::{command, BootstrapCommand};
+
 pub fn exe(name: &str, target: TargetSelection) -> String {
     crate::utils::shared_helpers::exe(name, &target.triple)
 }
diff --git a/src/bootstrap/src/utils/helpers/tests.rs b/src/bootstrap/src/utils/helpers/tests.rs
index 2ab3952ae5a..f0cb324674f 100644
--- a/src/bootstrap/src/utils/helpers/tests.rs
+++ b/src/bootstrap/src/utils/helpers/tests.rs
@@ -1,14 +1,11 @@
-use crate::{
-    utils::helpers::{
-        check_cfg_arg, extract_beta_rev, hex_encode, make, program_out_of_date, symlink_dir,
-    },
-    Config,
-};
-use std::{
-    fs::{self, remove_file, File},
-    io::Write,
-    path::PathBuf,
+use std::fs::{self, remove_file, File};
+use std::io::Write;
+use std::path::PathBuf;
+
+use crate::utils::helpers::{
+    check_cfg_arg, extract_beta_rev, hex_encode, make, program_out_of_date, symlink_dir,
 };
+use crate::Config;
 
 #[test]
 fn test_make() {
diff --git a/src/bootstrap/src/utils/job.rs b/src/bootstrap/src/utils/job.rs
index d7d20e57bd1..4012f5167ff 100644
--- a/src/bootstrap/src/utils/job.rs
+++ b/src/bootstrap/src/utils/job.rs
@@ -40,28 +40,25 @@ pub unsafe fn setup(build: &mut crate::Build) {
 /// Note that this is a Windows specific module as none of this logic is required on Unix.
 #[cfg(windows)]
 mod for_windows {
-    use crate::Build;
-    use std::env;
     use std::ffi::c_void;
-    use std::io;
-    use std::mem;
+    use std::{env, io, mem};
 
-    use windows::{
-        core::PCWSTR,
-        Win32::Foundation::{CloseHandle, DuplicateHandle, DUPLICATE_SAME_ACCESS, HANDLE},
-        Win32::System::Diagnostics::Debug::{
-            SetErrorMode, SEM_NOGPFAULTERRORBOX, THREAD_ERROR_MODE,
-        },
-        Win32::System::JobObjects::{
-            AssignProcessToJobObject, CreateJobObjectW, JobObjectExtendedLimitInformation,
-            SetInformationJobObject, JOBOBJECT_EXTENDED_LIMIT_INFORMATION,
-            JOB_OBJECT_LIMIT_KILL_ON_JOB_CLOSE, JOB_OBJECT_LIMIT_PRIORITY_CLASS,
-        },
-        Win32::System::Threading::{
-            GetCurrentProcess, OpenProcess, BELOW_NORMAL_PRIORITY_CLASS, PROCESS_DUP_HANDLE,
-        },
+    use windows::core::PCWSTR;
+    use windows::Win32::Foundation::{CloseHandle, DuplicateHandle, DUPLICATE_SAME_ACCESS, HANDLE};
+    use windows::Win32::System::Diagnostics::Debug::{
+        SetErrorMode, SEM_NOGPFAULTERRORBOX, THREAD_ERROR_MODE,
+    };
+    use windows::Win32::System::JobObjects::{
+        AssignProcessToJobObject, CreateJobObjectW, JobObjectExtendedLimitInformation,
+        SetInformationJobObject, JOBOBJECT_EXTENDED_LIMIT_INFORMATION,
+        JOB_OBJECT_LIMIT_KILL_ON_JOB_CLOSE, JOB_OBJECT_LIMIT_PRIORITY_CLASS,
+    };
+    use windows::Win32::System::Threading::{
+        GetCurrentProcess, OpenProcess, BELOW_NORMAL_PRIORITY_CLASS, PROCESS_DUP_HANDLE,
     };
 
+    use crate::Build;
+
     pub unsafe fn setup(build: &mut Build) {
         // Enable the Windows Error Reporting dialog which msys disables,
         // so we can JIT debug rustc
diff --git a/src/bootstrap/src/utils/metrics.rs b/src/bootstrap/src/utils/metrics.rs
index 697dd2f3505..bd18eb35c1f 100644
--- a/src/bootstrap/src/utils/metrics.rs
+++ b/src/bootstrap/src/utils/metrics.rs
@@ -4,19 +4,21 @@
 //! As this module requires additional dependencies not present during local builds, it's cfg'd
 //! away whenever the `build.metrics` config option is not set to `true`.
 
-use crate::core::builder::{Builder, Step};
-use crate::utils::helpers::t;
-use crate::Build;
-use build_helper::metrics::{
-    JsonInvocation, JsonInvocationSystemStats, JsonNode, JsonRoot, JsonStepSystemStats, Test,
-    TestOutcome, TestSuite, TestSuiteMetadata,
-};
 use std::cell::RefCell;
 use std::fs::File;
 use std::io::BufWriter;
 use std::time::{Duration, Instant, SystemTime};
+
+use build_helper::metrics::{
+    JsonInvocation, JsonInvocationSystemStats, JsonNode, JsonRoot, JsonStepSystemStats, Test,
+    TestOutcome, TestSuite, TestSuiteMetadata,
+};
 use sysinfo::System;
 
+use crate::core::builder::{Builder, Step};
+use crate::utils::helpers::t;
+use crate::Build;
+
 // Update this number whenever a breaking change is made to the build metrics.
 //
 // The output format is versioned for two reasons:
diff --git a/src/bootstrap/src/utils/render_tests.rs b/src/bootstrap/src/utils/render_tests.rs
index a3d0d36e754..b8aebc28549 100644
--- a/src/bootstrap/src/utils/render_tests.rs
+++ b/src/bootstrap/src/utils/render_tests.rs
@@ -6,13 +6,15 @@
 //! and rustc) libtest doesn't include the rendered human-readable output as a JSON field. We had
 //! to reimplement all the rendering logic in this module because of that.
 
-use crate::core::builder::Builder;
-use crate::utils::exec::BootstrapCommand;
 use std::io::{BufRead, BufReader, Read, Write};
 use std::process::{ChildStdout, Stdio};
 use std::time::Duration;
+
 use termcolor::{Color, ColorSpec, WriteColor};
 
+use crate::core::builder::Builder;
+use crate::utils::exec::BootstrapCommand;
+
 const TERSE_TESTS_PER_LINE: usize = 88;
 
 pub(crate) fn add_flags_and_try_run_tests(
diff --git a/src/bootstrap/src/utils/tarball.rs b/src/bootstrap/src/utils/tarball.rs
index cef67ae4c37..bfe2f084552 100644
--- a/src/bootstrap/src/utils/tarball.rs
+++ b/src/bootstrap/src/utils/tarball.rs
@@ -7,8 +7,8 @@
 
 use std::path::{Path, PathBuf};
 
-use crate::core::builder::Builder;
-use crate::core::{build_steps::dist::distdir, builder::Kind};
+use crate::core::build_steps::dist::distdir;
+use crate::core::builder::{Builder, Kind};
 use crate::utils::exec::BootstrapCommand;
 use crate::utils::helpers::{move_file, t};
 use crate::utils::{channel, helpers};
diff --git a/src/ci/docker/host-x86_64/test-various/uefi_qemu_test/src/main.rs b/src/ci/docker/host-x86_64/test-various/uefi_qemu_test/src/main.rs
index 2ec554c140b..d75ee147799 100644
--- a/src/ci/docker/host-x86_64/test-various/uefi_qemu_test/src/main.rs
+++ b/src/ci/docker/host-x86_64/test-various/uefi_qemu_test/src/main.rs
@@ -5,6 +5,7 @@
 #![no_std]
 
 use core::{panic, ptr};
+
 use r_efi::efi::{Char16, Handle, Status, SystemTable, RESET_SHUTDOWN};
 
 #[panic_handler]
diff --git a/src/librustdoc/clean/auto_trait.rs b/src/librustdoc/clean/auto_trait.rs
index ac927e9a194..f46ffea830e 100644
--- a/src/librustdoc/clean/auto_trait.rs
+++ b/src/librustdoc/clean/auto_trait.rs
@@ -6,13 +6,11 @@ use rustc_middle::ty::{self, Region, Ty};
 use rustc_span::def_id::DefId;
 use rustc_span::symbol::{kw, Symbol};
 use rustc_trait_selection::traits::auto_trait::{self, RegionTarget};
-
 use thin_vec::ThinVec;
 
-use crate::clean::{self, simplify, Lifetime};
 use crate::clean::{
-    clean_generic_param_def, clean_middle_ty, clean_predicate, clean_trait_ref_with_constraints,
-    clean_ty_generics,
+    self, clean_generic_param_def, clean_middle_ty, clean_predicate,
+    clean_trait_ref_with_constraints, clean_ty_generics, simplify, Lifetime,
 };
 use crate::core::DocContext;
 
diff --git a/src/librustdoc/clean/blanket_impl.rs b/src/librustdoc/clean/blanket_impl.rs
index 4c7a2ecdb53..48c3fb65203 100644
--- a/src/librustdoc/clean/blanket_impl.rs
+++ b/src/librustdoc/clean/blanket_impl.rs
@@ -5,7 +5,6 @@ use rustc_middle::ty::{self, Upcast};
 use rustc_span::def_id::DefId;
 use rustc_span::DUMMY_SP;
 use rustc_trait_selection::traits::query::evaluate_obligation::InferCtxtExt;
-
 use thin_vec::ThinVec;
 
 use crate::clean;
diff --git a/src/librustdoc/clean/cfg.rs b/src/librustdoc/clean/cfg.rs
index 2814e83dcd7..fb9754c7ffc 100644
--- a/src/librustdoc/clean/cfg.rs
+++ b/src/librustdoc/clean/cfg.rs
@@ -4,15 +4,13 @@
 // switch to use those structures instead.
 
 use std::fmt::{self, Write};
-use std::mem;
-use std::ops;
+use std::{mem, ops};
 
 use rustc_ast::{LitKind, MetaItem, MetaItemKind, NestedMetaItem};
 use rustc_data_structures::fx::FxHashSet;
 use rustc_feature::Features;
 use rustc_session::parse::ParseSess;
 use rustc_span::symbol::{sym, Symbol};
-
 use rustc_span::Span;
 
 use crate::html::escape::Escape;
diff --git a/src/librustdoc/clean/cfg/tests.rs b/src/librustdoc/clean/cfg/tests.rs
index 2857f74c744..a9b3abadb20 100644
--- a/src/librustdoc/clean/cfg/tests.rs
+++ b/src/librustdoc/clean/cfg/tests.rs
@@ -1,11 +1,10 @@
-use super::*;
-
 use rustc_ast::{MetaItemLit, Path, Safety, StrStyle};
-use rustc_span::create_default_session_globals_then;
 use rustc_span::symbol::{kw, Ident};
-use rustc_span::DUMMY_SP;
+use rustc_span::{create_default_session_globals_then, DUMMY_SP};
 use thin_vec::thin_vec;
 
+use super::*;
+
 fn word_cfg(s: &str) -> Cfg {
     Cfg::Cfg(Symbol::intern(s), None)
 }
diff --git a/src/librustdoc/clean/inline.rs b/src/librustdoc/clean/inline.rs
index dbdc4a5ae71..d92bc845664 100644
--- a/src/librustdoc/clean/inline.rs
+++ b/src/librustdoc/clean/inline.rs
@@ -3,11 +3,7 @@
 use std::iter::once;
 use std::sync::Arc;
 
-use thin_vec::{thin_vec, ThinVec};
-
-use rustc_ast as ast;
 use rustc_data_structures::fx::FxHashSet;
-use rustc_hir as hir;
 use rustc_hir::def::{DefKind, Res};
 use rustc_hir::def_id::{DefId, DefIdSet, LocalModDefId};
 use rustc_hir::Mutability;
@@ -17,7 +13,10 @@ use rustc_middle::ty::{self, TyCtxt};
 use rustc_span::def_id::LOCAL_CRATE;
 use rustc_span::hygiene::MacroKind;
 use rustc_span::symbol::{kw, sym, Symbol};
+use thin_vec::{thin_vec, ThinVec};
+use {rustc_ast as ast, rustc_hir as hir};
 
+use super::Item;
 use crate::clean::{
     self, clean_bound_vars, clean_generics, clean_impl_item, clean_middle_assoc_item,
     clean_middle_field, clean_middle_ty, clean_poly_fn_sig, clean_trait_ref_with_constraints,
@@ -27,8 +26,6 @@ use crate::clean::{
 use crate::core::DocContext;
 use crate::formats::item_type::ItemType;
 
-use super::Item;
-
 /// Attempt to inline a definition into this AST.
 ///
 /// This function will fetch the definition specified, and if it is
diff --git a/src/librustdoc/clean/mod.rs b/src/librustdoc/clean/mod.rs
index aaefac32711..0dfda83c25d 100644
--- a/src/librustdoc/clean/mod.rs
+++ b/src/librustdoc/clean/mod.rs
@@ -30,41 +30,36 @@ mod simplify;
 pub(crate) mod types;
 pub(crate) mod utils;
 
-use rustc_ast as ast;
+use std::borrow::Cow;
+use std::collections::BTreeMap;
+use std::mem;
+
 use rustc_ast::token::{Token, TokenKind};
 use rustc_ast::tokenstream::{TokenStream, TokenTree};
-use rustc_attr as attr;
 use rustc_data_structures::fx::{FxHashMap, FxHashSet, FxIndexMap, FxIndexSet, IndexEntry};
-use rustc_errors::{codes::*, struct_span_code_err, FatalError};
-use rustc_hir as hir;
+use rustc_errors::codes::*;
+use rustc_errors::{struct_span_code_err, FatalError};
 use rustc_hir::def::{CtorKind, DefKind, Res};
 use rustc_hir::def_id::{DefId, DefIdMap, DefIdSet, LocalDefId, LOCAL_CRATE};
 use rustc_hir::PredicateOrigin;
 use rustc_hir_analysis::lower_ty;
 use rustc_middle::metadata::Reexport;
 use rustc_middle::middle::resolve_bound_vars as rbv;
-use rustc_middle::ty::GenericArgsRef;
-use rustc_middle::ty::TypeVisitableExt;
-use rustc_middle::ty::{self, AdtKind, Ty, TyCtxt};
+use rustc_middle::ty::{self, AdtKind, GenericArgsRef, Ty, TyCtxt, TypeVisitableExt};
 use rustc_middle::{bug, span_bug};
 use rustc_span::hygiene::{AstPass, MacroKind};
 use rustc_span::symbol::{kw, sym, Ident, Symbol};
 use rustc_span::ExpnKind;
 use rustc_trait_selection::traits::wf::object_region_bounds;
-
-use std::borrow::Cow;
-use std::collections::BTreeMap;
-use std::mem;
 use thin_vec::ThinVec;
-
-use crate::core::DocContext;
-use crate::formats::item_type::ItemType;
-use crate::visit_ast::Module as DocModule;
-
 use utils::*;
+use {rustc_ast as ast, rustc_attr as attr, rustc_hir as hir};
 
 pub(crate) use self::types::*;
 pub(crate) use self::utils::{krate, register_res, synthesize_auto_trait_and_blanket_impls};
+use crate::core::DocContext;
+use crate::formats::item_type::ItemType;
+use crate::visit_ast::Module as DocModule;
 
 pub(crate) fn clean_doc_module<'tcx>(doc: &DocModule<'tcx>, cx: &mut DocContext<'tcx>) -> Item {
     let mut items: Vec<Item> = vec![];
diff --git a/src/librustdoc/clean/simplify.rs b/src/librustdoc/clean/simplify.rs
index 1b7d84add1f..739f6eb8cc8 100644
--- a/src/librustdoc/clean/simplify.rs
+++ b/src/librustdoc/clean/simplify.rs
@@ -18,8 +18,7 @@ use rustc_middle::ty;
 use thin_vec::ThinVec;
 
 use crate::clean;
-use crate::clean::GenericArgs as PP;
-use crate::clean::WherePredicate as WP;
+use crate::clean::{GenericArgs as PP, WherePredicate as WP};
 use crate::core::DocContext;
 
 pub(crate) fn where_clauses(cx: &DocContext<'_>, clauses: ThinVec<WP>) -> ThinVec<WP> {
diff --git a/src/librustdoc/clean/types.rs b/src/librustdoc/clean/types.rs
index 92fe98130e8..1ec5f38b6ec 100644
--- a/src/librustdoc/clean/types.rs
+++ b/src/librustdoc/clean/types.rs
@@ -3,19 +3,14 @@ use std::cell::RefCell;
 use std::hash::Hash;
 use std::path::PathBuf;
 use std::rc::Rc;
-use std::sync::Arc;
-use std::sync::OnceLock as OnceCell;
+use std::sync::{Arc, OnceLock as OnceCell};
 use std::{fmt, iter};
 
 use arrayvec::ArrayVec;
-use thin_vec::ThinVec;
-
-use rustc_ast as ast;
 use rustc_ast_pretty::pprust;
 use rustc_attr::{ConstStability, Deprecation, Stability, StabilityLevel, StableSince};
 use rustc_const_eval::const_eval::is_unstable_const_fn;
 use rustc_data_structures::fx::{FxHashMap, FxHashSet};
-use rustc_hir as hir;
 use rustc_hir::def::{CtorKind, DefKind, Res};
 use rustc_hir::def_id::{CrateNum, DefId, LOCAL_CRATE};
 use rustc_hir::lang_items::LangItem;
@@ -35,7 +30,15 @@ use rustc_span::symbol::{kw, sym, Ident, Symbol};
 use rustc_span::{FileName, Loc, DUMMY_SP};
 use rustc_target::abi::VariantIdx;
 use rustc_target::spec::abi::Abi;
+use thin_vec::ThinVec;
+use {rustc_ast as ast, rustc_hir as hir};
 
+pub(crate) use self::ItemKind::*;
+pub(crate) use self::SelfTy::*;
+pub(crate) use self::Type::{
+    Array, BareFunction, BorrowedRef, DynTrait, Generic, ImplTrait, Infer, Primitive, QPath,
+    RawPointer, Slice, Tuple,
+};
 use crate::clean::cfg::Cfg;
 use crate::clean::clean_middle_path;
 use crate::clean::inline::{self, print_inlined_const};
@@ -46,13 +49,6 @@ use crate::formats::item_type::ItemType;
 use crate::html::render::Context;
 use crate::passes::collect_intra_doc_links::UrlFragment;
 
-pub(crate) use self::ItemKind::*;
-pub(crate) use self::SelfTy::*;
-pub(crate) use self::Type::{
-    Array, BareFunction, BorrowedRef, DynTrait, Generic, ImplTrait, Infer, Primitive, QPath,
-    RawPointer, Slice, Tuple,
-};
-
 #[cfg(test)]
 mod tests;
 
@@ -2586,8 +2582,9 @@ pub(crate) enum AssocItemConstraintKind {
 // Some nodes are used a lot. Make sure they don't unintentionally get bigger.
 #[cfg(target_pointer_width = "64")]
 mod size_asserts {
-    use super::*;
     use rustc_data_structures::static_assert_size;
+
+    use super::*;
     // tidy-alphabetical-start
     static_assert_size!(Crate, 64); // frequently moved by-value
     static_assert_size!(DocFragment, 32);
diff --git a/src/librustdoc/clean/types/tests.rs b/src/librustdoc/clean/types/tests.rs
index 4befce07170..ddf6a11ec4e 100644
--- a/src/librustdoc/clean/types/tests.rs
+++ b/src/librustdoc/clean/types/tests.rs
@@ -1,8 +1,8 @@
-use super::*;
-
 use rustc_resolve::rustdoc::{unindent_doc_fragments, DocFragmentKind};
 use rustc_span::create_default_session_globals_then;
 
+use super::*;
+
 fn create_doc_fragment(s: &str) -> Vec<DocFragment> {
     vec![DocFragment {
         span: DUMMY_SP,
diff --git a/src/librustdoc/clean/utils.rs b/src/librustdoc/clean/utils.rs
index 7c83d438719..2dd3041ab4c 100644
--- a/src/librustdoc/clean/utils.rs
+++ b/src/librustdoc/clean/utils.rs
@@ -1,3 +1,18 @@
+use std::assert_matches::debug_assert_matches;
+use std::fmt::Write as _;
+use std::mem;
+use std::sync::LazyLock as Lazy;
+
+use rustc_ast::tokenstream::TokenTree;
+use rustc_hir::def::{DefKind, Res};
+use rustc_hir::def_id::{DefId, LocalDefId, LOCAL_CRATE};
+use rustc_metadata::rendered_const;
+use rustc_middle::mir;
+use rustc_middle::ty::{self, GenericArgKind, GenericArgsRef, TyCtxt, TypeVisitableExt};
+use rustc_span::symbol::{kw, sym, Symbol};
+use thin_vec::{thin_vec, ThinVec};
+use {rustc_ast as ast, rustc_hir as hir};
+
 use crate::clean::auto_trait::synthesize_auto_trait_impls;
 use crate::clean::blanket_impl::synthesize_blanket_impls;
 use crate::clean::render_macro_matchers::render_macro_matcher;
@@ -10,22 +25,6 @@ use crate::clean::{
 use crate::core::DocContext;
 use crate::html::format::visibility_to_src_with_space;
 
-use rustc_ast as ast;
-use rustc_ast::tokenstream::TokenTree;
-use rustc_hir as hir;
-use rustc_hir::def::{DefKind, Res};
-use rustc_hir::def_id::{DefId, LocalDefId, LOCAL_CRATE};
-use rustc_metadata::rendered_const;
-use rustc_middle::mir;
-use rustc_middle::ty::TypeVisitableExt;
-use rustc_middle::ty::{self, GenericArgKind, GenericArgsRef, TyCtxt};
-use rustc_span::symbol::{kw, sym, Symbol};
-use std::assert_matches::debug_assert_matches;
-use std::fmt::Write as _;
-use std::mem;
-use std::sync::LazyLock as Lazy;
-use thin_vec::{thin_vec, ThinVec};
-
 #[cfg(test)]
 mod tests;
 
diff --git a/src/librustdoc/config.rs b/src/librustdoc/config.rs
index 45bd1616e83..e4549796b3e 100644
--- a/src/librustdoc/config.rs
+++ b/src/librustdoc/config.rs
@@ -1,38 +1,32 @@
 use std::collections::BTreeMap;
 use std::ffi::OsStr;
-use std::fmt;
-use std::io;
 use std::io::Read;
-use std::path::Path;
-use std::path::PathBuf;
+use std::path::{Path, PathBuf};
 use std::str::FromStr;
+use std::{fmt, io};
 
 use rustc_data_structures::fx::FxHashMap;
 use rustc_errors::DiagCtxtHandle;
 use rustc_session::config::{
-    self, parse_crate_types_from_list, parse_externs, parse_target_triple, CrateType,
+    self, get_cmd_lint_options, nightly_options, parse_crate_types_from_list, parse_externs,
+    parse_target_triple, CodegenOptions, CrateType, ErrorOutputType, Externs, Input,
+    JsonUnusedExterns, UnstableOptions,
 };
-use rustc_session::config::{get_cmd_lint_options, nightly_options};
-use rustc_session::config::{CodegenOptions, ErrorOutputType, Externs, Input};
-use rustc_session::config::{JsonUnusedExterns, UnstableOptions};
-use rustc_session::getopts;
 use rustc_session::lint::Level;
 use rustc_session::search_paths::SearchPath;
-use rustc_session::EarlyDiagCtxt;
+use rustc_session::{getopts, EarlyDiagCtxt};
 use rustc_span::edition::Edition;
 use rustc_span::FileName;
 use rustc_target::spec::TargetTriple;
 
 use crate::core::new_dcx;
 use crate::externalfiles::ExternalHtml;
-use crate::html;
 use crate::html::markdown::IdMap;
 use crate::html::render::StylePath;
 use crate::html::static_files;
-use crate::opts;
 use crate::passes::{self, Condition};
 use crate::scrape_examples::{AllCallLocations, ScrapeExamplesOptions};
-use crate::theme;
+use crate::{html, opts, theme};
 
 #[derive(Clone, Copy, PartialEq, Eq, Debug, Default)]
 pub(crate) enum OutputFormat {
diff --git a/src/librustdoc/core.rs b/src/librustdoc/core.rs
index 5d8e61f9fa0..3e1271f198c 100644
--- a/src/librustdoc/core.rs
+++ b/src/librustdoc/core.rs
@@ -1,9 +1,16 @@
+use std::cell::RefCell;
+use std::rc::Rc;
+use std::sync::atomic::AtomicBool;
+use std::sync::{Arc, LazyLock};
+use std::{io, mem};
+
 use rustc_data_structures::fx::{FxHashMap, FxHashSet};
 use rustc_data_structures::sync::Lrc;
 use rustc_data_structures::unord::UnordSet;
+use rustc_errors::codes::*;
 use rustc_errors::emitter::{stderr_destination, DynEmitter, HumanEmitter};
 use rustc_errors::json::JsonEmitter;
-use rustc_errors::{codes::*, DiagCtxtHandle, ErrorGuaranteed, TerminalUrl};
+use rustc_errors::{DiagCtxtHandle, ErrorGuaranteed, TerminalUrl};
 use rustc_feature::UnstableFeatures;
 use rustc_hir::def::Res;
 use rustc_hir::def_id::{DefId, DefIdMap, DefIdSet, LocalDefId};
@@ -14,25 +21,17 @@ use rustc_lint::{late_lint_mod, MissingDoc};
 use rustc_middle::hir::nested_filter;
 use rustc_middle::ty::{ParamEnv, Ty, TyCtxt};
 use rustc_session::config::{self, CrateType, ErrorOutputType, ResolveDocLinks};
-use rustc_session::lint;
-use rustc_session::Session;
+pub(crate) use rustc_session::config::{Options, UnstableOptions};
+use rustc_session::{lint, Session};
 use rustc_span::symbol::sym;
 use rustc_span::{source_map, Span};
 
-use std::cell::RefCell;
-use std::io;
-use std::mem;
-use std::rc::Rc;
-use std::sync::LazyLock;
-use std::sync::{atomic::AtomicBool, Arc};
-
 use crate::clean::inline::build_external_trait;
 use crate::clean::{self, ItemId};
 use crate::config::{Options as RustdocOptions, OutputFormat, RenderOptions};
 use crate::formats::cache::Cache;
-use crate::passes::{self, Condition::*};
-
-pub(crate) use rustc_session::config::{Options, UnstableOptions};
+use crate::passes::Condition::*;
+use crate::passes::{self};
 
 pub(crate) struct DocContext<'tcx> {
     pub(crate) tcx: TyCtxt<'tcx>,
diff --git a/src/librustdoc/docfs.rs b/src/librustdoc/docfs.rs
index 1f7abdfc315..0ca070ddb8e 100644
--- a/src/librustdoc/docfs.rs
+++ b/src/librustdoc/docfs.rs
@@ -9,11 +9,11 @@
 //! abstraction.
 
 use std::cmp::max;
-use std::fs;
-use std::io;
 use std::path::{Path, PathBuf};
 use std::sync::mpsc::Sender;
 use std::thread::available_parallelism;
+use std::{fs, io};
+
 use threadpool::ThreadPool;
 
 pub(crate) trait PathError {
diff --git a/src/librustdoc/doctest.rs b/src/librustdoc/doctest.rs
index 40cc4a9d441..41eb142dd1e 100644
--- a/src/librustdoc/doctest.rs
+++ b/src/librustdoc/doctest.rs
@@ -2,9 +2,16 @@ mod make;
 mod markdown;
 mod rust;
 
+use std::fs::File;
+use std::io::{self, Write};
+use std::path::{Path, PathBuf};
+use std::process::{self, Command, Stdio};
+use std::sync::atomic::{AtomicUsize, Ordering};
+use std::sync::{Arc, Mutex};
+use std::{panic, str};
+
 pub(crate) use make::make_test;
 pub(crate) use markdown::test as test_markdown;
-
 use rustc_ast as ast;
 use rustc_data_structures::fx::{FxHashMap, FxHashSet};
 use rustc_errors::{ColorConfig, DiagCtxtHandle, ErrorGuaranteed, FatalError};
@@ -17,24 +24,13 @@ use rustc_span::edition::Edition;
 use rustc_span::symbol::sym;
 use rustc_span::FileName;
 use rustc_target::spec::{Target, TargetTriple};
-
-use std::fs::File;
-use std::io::{self, Write};
-use std::panic;
-use std::path::{Path, PathBuf};
-use std::process::{self, Command, Stdio};
-use std::str;
-use std::sync::atomic::{AtomicUsize, Ordering};
-use std::sync::{Arc, Mutex};
-
 use tempfile::{Builder as TempFileBuilder, TempDir};
 
+use self::rust::HirCollector;
 use crate::config::Options as RustdocOptions;
 use crate::html::markdown::{ErrorCodes, Ignore, LangString, MdRelLine};
 use crate::lint::init_lints;
 
-use self::rust::HirCollector;
-
 /// Options that apply to all doctests in a crate or Markdown file (for `rustdoc foo.md`).
 #[derive(Clone)]
 pub(crate) struct GlobalTestOptions {
diff --git a/src/librustdoc/doctest/rust.rs b/src/librustdoc/doctest/rust.rs
index fc8e119ccc2..f179f3aa1c9 100644
--- a/src/librustdoc/doctest/rust.rs
+++ b/src/librustdoc/doctest/rust.rs
@@ -2,7 +2,8 @@
 
 use std::env;
 
-use rustc_data_structures::{fx::FxHashSet, sync::Lrc};
+use rustc_data_structures::fx::FxHashSet;
+use rustc_data_structures::sync::Lrc;
 use rustc_hir::def_id::{LocalDefId, CRATE_DEF_ID};
 use rustc_hir::{self as hir, intravisit, CRATE_HIR_ID};
 use rustc_middle::hir::map::Map;
@@ -14,7 +15,8 @@ use rustc_span::source_map::SourceMap;
 use rustc_span::{BytePos, FileName, Pos, Span, DUMMY_SP};
 
 use super::{DoctestVisitor, ScrapedDoctest};
-use crate::clean::{types::AttributesExt, Attributes};
+use crate::clean::types::AttributesExt;
+use crate::clean::Attributes;
 use crate::html::markdown::{self, ErrorCodes, LangString, MdRelLine};
 
 struct RustCollector {
diff --git a/src/librustdoc/doctest/tests.rs b/src/librustdoc/doctest/tests.rs
index 9124ec63267..0f13ee404c6 100644
--- a/src/librustdoc/doctest/tests.rs
+++ b/src/librustdoc/doctest/tests.rs
@@ -1,8 +1,9 @@
 use std::path::PathBuf;
 
-use super::{make_test, GlobalTestOptions};
 use rustc_span::edition::DEFAULT_EDITION;
 
+use super::{make_test, GlobalTestOptions};
+
 /// Default [`GlobalTestOptions`] for these unit tests.
 fn default_global_opts(crate_name: impl Into<String>) -> GlobalTestOptions {
     GlobalTestOptions {
diff --git a/src/librustdoc/externalfiles.rs b/src/librustdoc/externalfiles.rs
index 62cdc0bd5a6..b81fc5a0a71 100644
--- a/src/librustdoc/externalfiles.rs
+++ b/src/librustdoc/externalfiles.rs
@@ -1,12 +1,12 @@
-use crate::html::markdown::{ErrorCodes, HeadingOffset, IdMap, Markdown, Playground};
-use rustc_errors::DiagCtxtHandle;
-use rustc_span::edition::Edition;
-use std::fs;
 use std::path::Path;
-use std::str;
+use std::{fs, str};
 
+use rustc_errors::DiagCtxtHandle;
+use rustc_span::edition::Edition;
 use serde::Serialize;
 
+use crate::html::markdown::{ErrorCodes, HeadingOffset, IdMap, Markdown, Playground};
+
 #[derive(Clone, Debug, Serialize)]
 pub(crate) struct ExternalHtml {
     /// Content that will be included inline in the `<head>` section of a
diff --git a/src/librustdoc/formats/cache.rs b/src/librustdoc/formats/cache.rs
index a3b88a880f2..9f284486616 100644
--- a/src/librustdoc/formats/cache.rs
+++ b/src/librustdoc/formats/cache.rs
@@ -5,7 +5,8 @@ use rustc_hir::def_id::{CrateNum, DefId, DefIdMap, DefIdSet};
 use rustc_middle::ty::{self, TyCtxt};
 use rustc_span::Symbol;
 
-use crate::clean::{self, types::ExternalLocation, ExternalCrate, ItemId, PrimitiveType};
+use crate::clean::types::ExternalLocation;
+use crate::clean::{self, ExternalCrate, ItemId, PrimitiveType};
 use crate::core::DocContext;
 use crate::fold::DocFolder;
 use crate::formats::item_type::ItemType;
diff --git a/src/librustdoc/formats/item_type.rs b/src/librustdoc/formats/item_type.rs
index d5468798bd3..c860eb8c696 100644
--- a/src/librustdoc/formats/item_type.rs
+++ b/src/librustdoc/formats/item_type.rs
@@ -2,10 +2,9 @@
 
 use std::fmt;
 
-use serde::{Serialize, Serializer};
-
 use rustc_hir::def::{CtorOf, DefKind};
 use rustc_span::hygiene::MacroKind;
+use serde::{Serialize, Serializer};
 
 use crate::clean;
 
diff --git a/src/librustdoc/formats/mod.rs b/src/librustdoc/formats/mod.rs
index 0056fb48530..84adca8efa9 100644
--- a/src/librustdoc/formats/mod.rs
+++ b/src/librustdoc/formats/mod.rs
@@ -2,9 +2,8 @@ pub(crate) mod cache;
 pub(crate) mod item_type;
 pub(crate) mod renderer;
 
-use rustc_hir::def_id::DefId;
-
 pub(crate) use renderer::{run_format, FormatRenderer};
+use rustc_hir::def_id::DefId;
 
 use crate::clean::{self, ItemId};
 use crate::html::render::Context;
diff --git a/src/librustdoc/html/format.rs b/src/librustdoc/html/format.rs
index 18ee04a2f4d..d6aed75103d 100644
--- a/src/librustdoc/html/format.rs
+++ b/src/librustdoc/html/format.rs
@@ -12,11 +12,10 @@ use std::cell::Cell;
 use std::fmt::{self, Display, Write};
 use std::iter::{self, once};
 
-use rustc_ast as ast;
+use itertools::Itertools;
 use rustc_attr::{ConstStability, StabilityLevel, StableSince};
 use rustc_data_structures::captures::Captures;
 use rustc_data_structures::fx::FxHashSet;
-use rustc_hir as hir;
 use rustc_hir::def::DefKind;
 use rustc_hir::def_id::{DefId, LOCAL_CRATE};
 use rustc_metadata::creader::{CStore, LoadedMacro};
@@ -25,21 +24,18 @@ use rustc_middle::ty::TyCtxt;
 use rustc_span::symbol::kw;
 use rustc_span::{sym, Symbol};
 use rustc_target::spec::abi::Abi;
+use {rustc_ast as ast, rustc_hir as hir};
 
-use itertools::Itertools;
-
-use crate::clean::{
-    self, types::ExternalLocation, utils::find_nearest_parent_module, ExternalCrate, PrimitiveType,
-};
+use super::url_parts_builder::{estimate_item_path_byte_length, UrlPartsBuilder};
+use crate::clean::types::ExternalLocation;
+use crate::clean::utils::find_nearest_parent_module;
+use crate::clean::{self, ExternalCrate, PrimitiveType};
 use crate::formats::cache::Cache;
 use crate::formats::item_type::ItemType;
 use crate::html::escape::Escape;
 use crate::html::render::Context;
 use crate::passes::collect_intra_doc_links::UrlFragment;
 
-use super::url_parts_builder::estimate_item_path_byte_length;
-use super::url_parts_builder::UrlPartsBuilder;
-
 pub(crate) trait Print {
     fn print(self, buffer: &mut Buffer);
 }
diff --git a/src/librustdoc/html/highlight.rs b/src/librustdoc/html/highlight.rs
index 336d18a1df1..29b4889a6ab 100644
--- a/src/librustdoc/html/highlight.rs
+++ b/src/librustdoc/html/highlight.rs
@@ -5,10 +5,6 @@
 //!
 //! Use the `render_with_highlighting` to highlight some rust code.
 
-use crate::clean::PrimitiveType;
-use crate::html::escape::EscapeBodyText;
-use crate::html::render::{Context, LinkFromSrc};
-
 use std::collections::VecDeque;
 use std::fmt::{Display, Write};
 
@@ -19,6 +15,9 @@ use rustc_span::symbol::Symbol;
 use rustc_span::{BytePos, Span, DUMMY_SP};
 
 use super::format::{self, Buffer};
+use crate::clean::PrimitiveType;
+use crate::html::escape::EscapeBodyText;
+use crate::html::render::{Context, LinkFromSrc};
 
 /// This type is needed in case we want to render links on items to allow to go to their definition.
 pub(crate) struct HrefContext<'a, 'tcx> {
diff --git a/src/librustdoc/html/highlight/tests.rs b/src/librustdoc/html/highlight/tests.rs
index 4c0874a686f..9d511018dec 100644
--- a/src/librustdoc/html/highlight/tests.rs
+++ b/src/librustdoc/html/highlight/tests.rs
@@ -1,9 +1,10 @@
-use super::{write_code, DecorationInfo};
-use crate::html::format::Buffer;
 use expect_test::expect_file;
 use rustc_data_structures::fx::FxHashMap;
 use rustc_span::create_default_session_globals_then;
 
+use super::{write_code, DecorationInfo};
+use crate::html::format::Buffer;
+
 const STYLE: &str = r#"
 <style>
 .kw { color: #8959A8; }
diff --git a/src/librustdoc/html/layout.rs b/src/librustdoc/html/layout.rs
index 22576b76e41..7dfcc88398f 100644
--- a/src/librustdoc/html/layout.rs
+++ b/src/librustdoc/html/layout.rs
@@ -1,15 +1,13 @@
 use std::path::PathBuf;
 
+use rinja::Template;
 use rustc_data_structures::fx::FxHashMap;
 
+use super::static_files::{StaticFiles, STATIC_FILES};
 use crate::externalfiles::ExternalHtml;
 use crate::html::format::{Buffer, Print};
 use crate::html::render::{ensure_trailing_slash, StylePath};
 
-use rinja::Template;
-
-use super::static_files::{StaticFiles, STATIC_FILES};
-
 #[derive(Clone)]
 pub(crate) struct Layout {
     pub(crate) logo: String,
diff --git a/src/librustdoc/html/markdown.rs b/src/librustdoc/html/markdown.rs
index a7f0df5afa9..97d97808b93 100644
--- a/src/librustdoc/html/markdown.rs
+++ b/src/librustdoc/html/markdown.rs
@@ -25,15 +25,6 @@
 //! // ... something using html
 //! ```
 
-use rustc_data_structures::fx::FxHashMap;
-use rustc_errors::{Diag, DiagMessage};
-use rustc_hir::def_id::DefId;
-use rustc_middle::ty::TyCtxt;
-pub(crate) use rustc_resolve::rustdoc::main_body_opts;
-use rustc_resolve::rustdoc::may_be_doc_link;
-use rustc_span::edition::Edition;
-use rustc_span::{Span, Symbol};
-
 use std::borrow::Cow;
 use std::collections::VecDeque;
 use std::fmt::Write;
@@ -43,6 +34,19 @@ use std::path::PathBuf;
 use std::str::{self, CharIndices};
 use std::sync::OnceLock;
 
+use pulldown_cmark::{
+    html, BrokenLink, BrokenLinkCallback, CodeBlockKind, CowStr, Event, LinkType, OffsetIter,
+    Options, Parser, Tag, TagEnd,
+};
+use rustc_data_structures::fx::FxHashMap;
+use rustc_errors::{Diag, DiagMessage};
+use rustc_hir::def_id::DefId;
+use rustc_middle::ty::TyCtxt;
+pub(crate) use rustc_resolve::rustdoc::main_body_opts;
+use rustc_resolve::rustdoc::may_be_doc_link;
+use rustc_span::edition::Edition;
+use rustc_span::{Span, Symbol};
+
 use crate::clean::RenderedLink;
 use crate::doctest;
 use crate::doctest::GlobalTestOptions;
@@ -53,11 +57,6 @@ use crate::html::length_limit::HtmlWithLimit;
 use crate::html::render::small_url_encode;
 use crate::html::toc::TocBuilder;
 
-use pulldown_cmark::{
-    html, BrokenLink, BrokenLinkCallback, CodeBlockKind, CowStr, Event, LinkType, OffsetIter,
-    Options, Parser, Tag, TagEnd,
-};
-
 #[cfg(test)]
 mod tests;
 
diff --git a/src/librustdoc/html/markdown/tests.rs b/src/librustdoc/html/markdown/tests.rs
index fb74c079c9a..971120d4991 100644
--- a/src/librustdoc/html/markdown/tests.rs
+++ b/src/librustdoc/html/markdown/tests.rs
@@ -1,9 +1,9 @@
-use super::{find_testable_code, plain_text_summary, short_markdown_summary};
+use rustc_span::edition::{Edition, DEFAULT_EDITION};
+
 use super::{
-    ErrorCodes, HeadingOffset, IdMap, Ignore, LangString, LangStringToken, Markdown,
-    MarkdownItemInfo, TagIterator,
+    find_testable_code, plain_text_summary, short_markdown_summary, ErrorCodes, HeadingOffset,
+    IdMap, Ignore, LangString, LangStringToken, Markdown, MarkdownItemInfo, TagIterator,
 };
-use rustc_span::edition::{Edition, DEFAULT_EDITION};
 
 #[test]
 fn test_unique_id() {
diff --git a/src/librustdoc/html/render/context.rs b/src/librustdoc/html/render/context.rs
index 7718413c956..0334eacc161 100644
--- a/src/librustdoc/html/render/context.rs
+++ b/src/librustdoc/html/render/context.rs
@@ -5,6 +5,7 @@ use std::path::{Path, PathBuf};
 use std::rc::Rc;
 use std::sync::mpsc::{channel, Receiver};
 
+use rinja::Template;
 use rustc_data_structures::fx::{FxHashMap, FxHashSet};
 use rustc_hir::def_id::{DefIdMap, LOCAL_CRATE};
 use rustc_middle::ty::TyCtxt;
@@ -14,15 +15,12 @@ use rustc_span::{sym, FileName, Symbol};
 
 use super::print_item::{full_path, item_path, print_item};
 use super::search_index::build_index;
+use super::sidebar::{print_sidebar, sidebar_module_like, Sidebar};
 use super::write_shared::write_shared;
-use super::{
-    collect_spans_and_sources, scrape_examples_help,
-    sidebar::print_sidebar,
-    sidebar::{sidebar_module_like, Sidebar},
-    AllTypes, LinkFromSrc, StylePath,
-};
+use super::{collect_spans_and_sources, scrape_examples_help, AllTypes, LinkFromSrc, StylePath};
+use crate::clean::types::ExternalLocation;
 use crate::clean::utils::has_doc_flag;
-use crate::clean::{self, types::ExternalLocation, ExternalCrate};
+use crate::clean::{self, ExternalCrate};
 use crate::config::{ModuleSorting, RenderOptions};
 use crate::docfs::{DocFS, PathError};
 use crate::error::Error;
@@ -36,7 +34,6 @@ use crate::html::url_parts_builder::UrlPartsBuilder;
 use crate::html::{layout, sources, static_files};
 use crate::scrape_examples::AllCallLocations;
 use crate::try_err;
-use rinja::Template;
 
 /// Major driving force in all rustdoc rendering. This contains information
 /// about where in the tree-like hierarchy rendering is occurring and controls
diff --git a/src/librustdoc/html/render/mod.rs b/src/librustdoc/html/render/mod.rs
index 47712264e97..aaac8678264 100644
--- a/src/librustdoc/html/render/mod.rs
+++ b/src/librustdoc/html/render/mod.rs
@@ -35,16 +35,12 @@ mod span_map;
 mod type_layout;
 mod write_shared;
 
-pub(crate) use self::context::*;
-pub(crate) use self::span_map::{collect_spans_and_sources, LinkFromSrc};
-
 use std::collections::VecDeque;
 use std::fmt::{self, Write};
-use std::fs;
 use std::iter::Peekable;
 use std::path::PathBuf;
 use std::rc::Rc;
-use std::str;
+use std::{fs, str};
 
 use rinja::Template;
 use rustc_attr::{ConstStability, DeprecatedSince, Deprecation, StabilityLevel, StableSince};
@@ -55,13 +51,13 @@ use rustc_hir::Mutability;
 use rustc_middle::ty::print::PrintTraitRefExt;
 use rustc_middle::ty::{self, TyCtxt};
 use rustc_session::RustcVersion;
-use rustc_span::{
-    symbol::{sym, Symbol},
-    BytePos, FileName, RealFileName, DUMMY_SP,
-};
+use rustc_span::symbol::{sym, Symbol};
+use rustc_span::{BytePos, FileName, RealFileName, DUMMY_SP};
 use serde::ser::SerializeMap;
 use serde::{Serialize, Serializer};
 
+pub(crate) use self::context::*;
+pub(crate) use self::span_map::{collect_spans_and_sources, LinkFromSrc};
 use crate::clean::{self, ItemId, RenderedLink, SelfTy};
 use crate::error::Error;
 use crate::formats::cache::Cache;
@@ -73,15 +69,13 @@ use crate::html::format::{
     print_default_space, print_generic_bounds, print_where_clause, visibility_print_with_space,
     Buffer, Ending, HrefError, PrintWithSpace,
 };
-use crate::html::highlight;
 use crate::html::markdown::{
     HeadingOffset, IdMap, Markdown, MarkdownItemInfo, MarkdownSummaryLine,
 };
-use crate::html::sources;
 use crate::html::static_files::SCRAPE_EXAMPLES_HELP_MD;
+use crate::html::{highlight, sources};
 use crate::scrape_examples::{CallData, CallLocation};
-use crate::try_none;
-use crate::DOC_RUST_LANG_ORG_CHANNEL;
+use crate::{try_none, DOC_RUST_LANG_ORG_CHANNEL};
 
 pub(crate) fn ensure_trailing_slash(v: &str) -> impl fmt::Display + '_ {
     crate::html::format::display_fn(move |f| {
diff --git a/src/librustdoc/html/render/print_item.rs b/src/librustdoc/html/render/print_item.rs
index 0cf62ccf6e7..24476e80778 100644
--- a/src/librustdoc/html/render/print_item.rs
+++ b/src/librustdoc/html/render/print_item.rs
@@ -1,3 +1,10 @@
+use std::cell::{RefCell, RefMut};
+use std::cmp::Ordering;
+use std::fmt;
+use std::rc::Rc;
+
+use itertools::Itertools;
+use rinja::Template;
 use rustc_data_structures::captures::Captures;
 use rustc_data_structures::fx::{FxHashMap, FxHashSet};
 use rustc_hir as hir;
@@ -8,10 +15,6 @@ use rustc_middle::ty::{self, TyCtxt};
 use rustc_span::hygiene::MacroKind;
 use rustc_span::symbol::{kw, sym, Symbol};
 use rustc_target::abi::VariantIdx;
-use std::cell::{RefCell, RefMut};
-use std::cmp::Ordering;
-use std::fmt;
-use std::rc::Rc;
 
 use super::type_layout::document_type_layout;
 use super::{
@@ -36,9 +39,6 @@ use crate::html::markdown::{HeadingOffset, MarkdownSummaryLine};
 use crate::html::render::{document_full, document_item_info};
 use crate::html::url_parts_builder::UrlPartsBuilder;
 
-use itertools::Itertools;
-use rinja::Template;
-
 /// Generates a Rinja template struct for rendering items with common methods.
 ///
 /// Usage:
diff --git a/src/librustdoc/html/render/search_index.rs b/src/librustdoc/html/render/search_index.rs
index 66d3f0fd8ce..b3f4d82e054 100644
--- a/src/librustdoc/html/render/search_index.rs
+++ b/src/librustdoc/html/render/search_index.rs
@@ -3,6 +3,7 @@ pub(crate) mod encode;
 use std::collections::hash_map::Entry;
 use std::collections::{BTreeMap, VecDeque};
 
+use encode::{bitmap_to_string, write_vlqhex_to_string};
 use rustc_data_structures::fx::{FxHashMap, FxIndexMap};
 use rustc_middle::ty::TyCtxt;
 use rustc_span::def_id::DefId;
@@ -19,8 +20,6 @@ use crate::html::format::join_with_double_colon;
 use crate::html::markdown::short_markdown_summary;
 use crate::html::render::{self, IndexItem, IndexItemFunctionType, RenderType, RenderTypeId};
 
-use encode::{bitmap_to_string, write_vlqhex_to_string};
-
 /// The serialized search description sharded version
 ///
 /// The `index` is a JSON-encoded list of names and other information.
diff --git a/src/librustdoc/html/render/sidebar.rs b/src/librustdoc/html/render/sidebar.rs
index e5bc2ace203..6e826446c0e 100644
--- a/src/librustdoc/html/render/sidebar.rs
+++ b/src/librustdoc/html/render/sidebar.rs
@@ -1,17 +1,18 @@
-use std::{borrow::Cow, rc::Rc};
+use std::borrow::Cow;
+use std::rc::Rc;
 
 use rinja::Template;
 use rustc_data_structures::fx::FxHashSet;
-use rustc_hir::{def::CtorKind, def_id::DefIdSet};
+use rustc_hir::def::CtorKind;
+use rustc_hir::def_id::DefIdSet;
 use rustc_middle::ty::{self, TyCtxt};
 
-use crate::{
-    clean,
-    formats::{item_type::ItemType, Impl},
-    html::{format::Buffer, markdown::IdMap},
-};
-
 use super::{item_ty_to_section, Context, ItemSection};
+use crate::clean;
+use crate::formats::item_type::ItemType;
+use crate::formats::Impl;
+use crate::html::format::Buffer;
+use crate::html::markdown::IdMap;
 
 #[derive(Template)]
 #[template(path = "sidebar.html")]
diff --git a/src/librustdoc/html/render/span_map.rs b/src/librustdoc/html/render/span_map.rs
index 0535246ae10..5b53277c059 100644
--- a/src/librustdoc/html/render/span_map.rs
+++ b/src/librustdoc/html/render/span_map.rs
@@ -1,5 +1,4 @@
-use crate::clean::{self, rustc_span, PrimitiveType};
-use crate::html::sources;
+use std::path::{Path, PathBuf};
 
 use rustc_data_structures::fx::FxHashMap;
 use rustc_hir::def::{DefKind, Res};
@@ -11,7 +10,8 @@ use rustc_middle::ty::TyCtxt;
 use rustc_span::hygiene::MacroKind;
 use rustc_span::{BytePos, ExpnKind, Span};
 
-use std::path::{Path, PathBuf};
+use crate::clean::{self, rustc_span, PrimitiveType};
+use crate::html::sources;
 
 /// This enum allows us to store two different kinds of information:
 ///
diff --git a/src/librustdoc/html/render/type_layout.rs b/src/librustdoc/html/render/type_layout.rs
index 35a38d5375f..cd4e597ff28 100644
--- a/src/librustdoc/html/render/type_layout.rs
+++ b/src/librustdoc/html/render/type_layout.rs
@@ -1,14 +1,14 @@
-use rinja::Template;
+use std::fmt;
 
+use rinja::Template;
 use rustc_data_structures::captures::Captures;
 use rustc_hir::def_id::DefId;
 use rustc_middle::span_bug;
-use rustc_middle::ty::{self, layout::LayoutError};
+use rustc_middle::ty::layout::LayoutError;
+use rustc_middle::ty::{self};
 use rustc_span::symbol::Symbol;
 use rustc_target::abi::{Primitive, TagEncoding, Variants};
 
-use std::fmt;
-
 use crate::html::format::display_fn;
 use crate::html::render::Context;
 
diff --git a/src/librustdoc/html/sources.rs b/src/librustdoc/html/sources.rs
index 7b4d1fa5305..22f115f92cc 100644
--- a/src/librustdoc/html/sources.rs
+++ b/src/librustdoc/html/sources.rs
@@ -1,12 +1,9 @@
-use crate::clean;
-use crate::clean::utils::has_doc_flag;
-use crate::docfs::PathError;
-use crate::error::Error;
-use crate::html::format;
-use crate::html::highlight;
-use crate::html::layout;
-use crate::html::render::Context;
-use crate::visit::DocVisitor;
+use std::cell::RefCell;
+use std::ffi::OsStr;
+use std::ops::RangeInclusive;
+use std::path::{Component, Path, PathBuf};
+use std::rc::Rc;
+use std::{fmt, fs};
 
 use rinja::Template;
 use rustc_data_structures::fx::{FxHashMap, FxHashSet};
@@ -15,13 +12,13 @@ use rustc_middle::ty::TyCtxt;
 use rustc_session::Session;
 use rustc_span::{sym, FileName};
 
-use std::cell::RefCell;
-use std::ffi::OsStr;
-use std::fmt;
-use std::fs;
-use std::ops::RangeInclusive;
-use std::path::{Component, Path, PathBuf};
-use std::rc::Rc;
+use crate::clean;
+use crate::clean::utils::has_doc_flag;
+use crate::docfs::PathError;
+use crate::error::Error;
+use crate::html::render::Context;
+use crate::html::{format, highlight, layout};
+use crate::visit::DocVisitor;
 
 pub(crate) fn render(cx: &mut Context<'_>, krate: &clean::Crate) -> Result<(), Error> {
     info!("emitting source files");
diff --git a/src/librustdoc/html/static_files.rs b/src/librustdoc/html/static_files.rs
index 035376bace9..6157598ba38 100644
--- a/src/librustdoc/html/static_files.rs
+++ b/src/librustdoc/html/static_files.rs
@@ -3,11 +3,12 @@
 //! All the static files are included here for centralized access in case anything other than the
 //! HTML rendering code (say, the theme checker) needs to access one of these files.
 
-use rustc_data_structures::fx::FxHasher;
 use std::hash::Hasher;
 use std::path::{Path, PathBuf};
 use std::{fmt, str};
 
+use rustc_data_structures::fx::FxHasher;
+
 pub(crate) struct StaticFile {
     pub(crate) filename: PathBuf,
     pub(crate) bytes: &'static [u8],
diff --git a/src/librustdoc/html/tests.rs b/src/librustdoc/html/tests.rs
index 437d3995e29..059f99c0c9e 100644
--- a/src/librustdoc/html/tests.rs
+++ b/src/librustdoc/html/tests.rs
@@ -1,6 +1,7 @@
-use crate::html::format::href_relative_parts;
 use rustc_span::{sym, Symbol};
 
+use crate::html::format::href_relative_parts;
+
 fn assert_relative_path(expected: &[Symbol], relative_to_fqp: &[Symbol], fqp: &[Symbol]) {
     // No `create_default_session_globals_then` call is needed here because all
     // the symbols used are static, and no `Symbol::intern` calls occur.
diff --git a/src/librustdoc/json/conversions.rs b/src/librustdoc/json/conversions.rs
index a4731feb8de..db9dafab9a4 100644
--- a/src/librustdoc/json/conversions.rs
+++ b/src/librustdoc/json/conversions.rs
@@ -8,14 +8,14 @@ use std::fmt;
 
 use rustc_ast::ast;
 use rustc_attr::DeprecatedSince;
-use rustc_hir::{def::CtorKind, def::DefKind, def_id::DefId};
+use rustc_hir::def::{CtorKind, DefKind};
+use rustc_hir::def_id::DefId;
 use rustc_metadata::rendered_const;
 use rustc_middle::bug;
 use rustc_middle::ty::{self, TyCtxt};
 use rustc_span::symbol::sym;
 use rustc_span::{Pos, Symbol};
 use rustc_target::spec::abi::Abi as RustcAbi;
-
 use rustdoc_json_types::*;
 
 use crate::clean::{self, ItemId};
diff --git a/src/librustdoc/json/import_finder.rs b/src/librustdoc/json/import_finder.rs
index 982370aa21c..976a7fd69ae 100644
--- a/src/librustdoc/json/import_finder.rs
+++ b/src/librustdoc/json/import_finder.rs
@@ -1,9 +1,7 @@
 use rustc_hir::def_id::DefIdSet;
 
-use crate::{
-    clean::{self, Import, ImportSource, Item},
-    fold::DocFolder,
-};
+use crate::clean::{self, Import, ImportSource, Item};
+use crate::fold::DocFolder;
 
 /// Get the id's of all items that are `pub use`d in the crate.
 ///
diff --git a/src/librustdoc/json/mod.rs b/src/librustdoc/json/mod.rs
index 0ef24818515..033f01864f1 100644
--- a/src/librustdoc/json/mod.rs
+++ b/src/librustdoc/json/mod.rs
@@ -18,7 +18,6 @@ use rustc_hir::def_id::{DefId, DefIdSet};
 use rustc_middle::ty::TyCtxt;
 use rustc_session::Session;
 use rustc_span::def_id::LOCAL_CRATE;
-
 use rustdoc_json_types as types;
 
 use crate::clean::types::{ExternalCrate, ExternalLocation};
diff --git a/src/librustdoc/lib.rs b/src/librustdoc/lib.rs
index fb4cd218b84..e651501a184 100644
--- a/src/librustdoc/lib.rs
+++ b/src/librustdoc/lib.rs
@@ -75,7 +75,8 @@ extern crate jemalloc_sys;
 use std::env::{self, VarError};
 use std::io::{self, IsTerminal};
 use std::process;
-use std::sync::{atomic::AtomicBool, Arc};
+use std::sync::atomic::AtomicBool;
+use std::sync::Arc;
 
 use rustc_errors::{DiagCtxtHandle, ErrorGuaranteed, FatalError};
 use rustc_interface::interface;
diff --git a/src/librustdoc/lint.rs b/src/librustdoc/lint.rs
index 5a8fd3ebb9c..754ba58648d 100644
--- a/src/librustdoc/lint.rs
+++ b/src/librustdoc/lint.rs
@@ -1,10 +1,10 @@
+use std::sync::LazyLock as Lazy;
+
 use rustc_data_structures::fx::FxHashMap;
 use rustc_lint::LintStore;
 use rustc_lint_defs::{declare_tool_lint, Lint, LintId};
 use rustc_session::{lint, Session};
 
-use std::sync::LazyLock as Lazy;
-
 /// This function is used to setup the lint initialization. By default, in rustdoc, everything
 /// is "allowed". Depending if we run in test mode or not, we want some of them to be at their
 /// default level. For example, the "INVALID_CODEBLOCK_ATTRIBUTES" lint is activated in both
diff --git a/src/librustdoc/passes/calculate_doc_coverage.rs b/src/librustdoc/passes/calculate_doc_coverage.rs
index 9e576002dc3..d6eef43902c 100644
--- a/src/librustdoc/passes/calculate_doc_coverage.rs
+++ b/src/librustdoc/passes/calculate_doc_coverage.rs
@@ -1,11 +1,8 @@
 //! Calculates information used for the --show-coverage flag.
 
-use crate::clean;
-use crate::core::DocContext;
-use crate::html::markdown::{find_testable_code, ErrorCodes};
-use crate::passes::check_doc_test_visibility::{should_have_doc_example, Tests};
-use crate::passes::Pass;
-use crate::visit::DocVisitor;
+use std::collections::BTreeMap;
+use std::ops;
+
 use rustc_hir as hir;
 use rustc_lint::builtin::MISSING_DOCS;
 use rustc_middle::lint::LintLevelSource;
@@ -13,8 +10,12 @@ use rustc_session::lint;
 use rustc_span::FileName;
 use serde::Serialize;
 
-use std::collections::BTreeMap;
-use std::ops;
+use crate::clean;
+use crate::core::DocContext;
+use crate::html::markdown::{find_testable_code, ErrorCodes};
+use crate::passes::check_doc_test_visibility::{should_have_doc_example, Tests};
+use crate::passes::Pass;
+use crate::visit::DocVisitor;
 
 pub(crate) const CALCULATE_DOC_COVERAGE: Pass = Pass {
     name: "calculate-doc-coverage",
diff --git a/src/librustdoc/passes/check_doc_test_visibility.rs b/src/librustdoc/passes/check_doc_test_visibility.rs
index f97c4178473..d78afdffc62 100644
--- a/src/librustdoc/passes/check_doc_test_visibility.rs
+++ b/src/librustdoc/passes/check_doc_test_visibility.rs
@@ -5,6 +5,10 @@
 //! - MISSING_DOC_CODE_EXAMPLES: this lint is **UNSTABLE** and looks for public items missing doctests.
 //! - PRIVATE_DOC_TESTS: this lint is **STABLE** and looks for private items with doctests.
 
+use rustc_hir as hir;
+use rustc_middle::lint::LintLevelSource;
+use rustc_session::lint;
+
 use super::Pass;
 use crate::clean;
 use crate::clean::utils::inherits_doc_hidden;
@@ -12,9 +16,6 @@ use crate::clean::*;
 use crate::core::DocContext;
 use crate::html::markdown::{find_testable_code, ErrorCodes, Ignore, LangString, MdRelLine};
 use crate::visit::DocVisitor;
-use rustc_hir as hir;
-use rustc_middle::lint::LintLevelSource;
-use rustc_session::lint;
 
 pub(crate) const CHECK_DOC_TEST_VISIBILITY: Pass = Pass {
     name: "check_doc_test_visibility",
diff --git a/src/librustdoc/passes/collect_intra_doc_links.rs b/src/librustdoc/passes/collect_intra_doc_links.rs
index 37f7e7ed385..9c7eee4040b 100644
--- a/src/librustdoc/passes/collect_intra_doc_links.rs
+++ b/src/librustdoc/passes/collect_intra_doc_links.rs
@@ -2,12 +2,15 @@
 //!
 //! [RFC 1946]: https://github.com/rust-lang/rfcs/blob/master/text/1946-intra-rustdoc-links.md
 
+use std::borrow::Cow;
+use std::fmt::Display;
+use std::mem;
+use std::ops::Range;
+
 use pulldown_cmark::LinkType;
 use rustc_ast::util::comments::may_have_doc_links;
-use rustc_data_structures::{
-    fx::{FxHashMap, FxHashSet},
-    intern::Interned,
-};
+use rustc_data_structures::fx::{FxHashMap, FxHashSet};
+use rustc_data_structures::intern::Interned;
 use rustc_errors::{Applicability, Diag, DiagMessage};
 use rustc_hir::def::Namespace::*;
 use rustc_hir::def::{DefKind, Namespace, PerNS};
@@ -15,9 +18,9 @@ use rustc_hir::def_id::{DefId, CRATE_DEF_ID};
 use rustc_hir::{Mutability, Safety};
 use rustc_middle::ty::{Ty, TyCtxt};
 use rustc_middle::{bug, span_bug, ty};
-use rustc_resolve::rustdoc::{has_primitive_or_keyword_docs, prepare_to_doc_link_resolution};
 use rustc_resolve::rustdoc::{
-    source_span_for_markdown_range, strip_generics_from_path, MalformedGenerics,
+    has_primitive_or_keyword_docs, prepare_to_doc_link_resolution, source_span_for_markdown_range,
+    strip_generics_from_path, MalformedGenerics,
 };
 use rustc_session::lint::Lint;
 use rustc_span::hygiene::MacroKind;
@@ -25,13 +28,8 @@ use rustc_span::symbol::{sym, Ident, Symbol};
 use rustc_span::BytePos;
 use smallvec::{smallvec, SmallVec};
 
-use std::borrow::Cow;
-use std::fmt::Display;
-use std::mem;
-use std::ops::Range;
-
-use crate::clean::{self, utils::find_nearest_parent_module};
-use crate::clean::{Crate, Item, ItemLink, PrimitiveType};
+use crate::clean::utils::find_nearest_parent_module;
+use crate::clean::{self, Crate, Item, ItemLink, PrimitiveType};
 use crate::core::DocContext;
 use crate::html::markdown::{markdown_links, MarkdownLink, MarkdownLinkRange};
 use crate::lint::{BROKEN_INTRA_DOC_LINKS, PRIVATE_INTRA_DOC_LINKS};
diff --git a/src/librustdoc/passes/collect_trait_impls.rs b/src/librustdoc/passes/collect_trait_impls.rs
index 9ac9941e521..1f00891ffa1 100644
--- a/src/librustdoc/passes/collect_trait_impls.rs
+++ b/src/librustdoc/passes/collect_trait_impls.rs
@@ -2,17 +2,17 @@
 //! defines a struct that implements a trait, this pass will note that the
 //! struct implements that trait.
 
+use rustc_data_structures::fx::FxHashSet;
+use rustc_hir::def_id::{DefId, DefIdMap, DefIdSet, LOCAL_CRATE};
+use rustc_middle::ty;
+use rustc_span::symbol::sym;
+
 use super::Pass;
 use crate::clean::*;
 use crate::core::DocContext;
 use crate::formats::cache::Cache;
 use crate::visit::DocVisitor;
 
-use rustc_data_structures::fx::FxHashSet;
-use rustc_hir::def_id::{DefId, DefIdMap, DefIdSet, LOCAL_CRATE};
-use rustc_middle::ty;
-use rustc_span::symbol::sym;
-
 pub(crate) const COLLECT_TRAIT_IMPLS: Pass = Pass {
     name: "collect-trait-impls",
     run: collect_trait_impls,
diff --git a/src/librustdoc/passes/lint/bare_urls.rs b/src/librustdoc/passes/lint/bare_urls.rs
index a4ba718789c..a0a369a7b85 100644
--- a/src/librustdoc/passes/lint/bare_urls.rs
+++ b/src/librustdoc/passes/lint/bare_urls.rs
@@ -1,16 +1,18 @@
 //! Detects links that are not linkified, e.g., in Markdown such as `Go to https://example.com/.`
 //! Suggests wrapping the link with angle brackets: `Go to <https://example.com/>.` to linkify it.
 
-use crate::clean::*;
-use crate::core::DocContext;
-use crate::html::markdown::main_body_opts;
 use core::ops::Range;
+use std::mem;
+use std::sync::LazyLock;
+
 use pulldown_cmark::{Event, Parser, Tag};
 use regex::Regex;
 use rustc_errors::Applicability;
 use rustc_resolve::rustdoc::source_span_for_markdown_range;
-use std::mem;
-use std::sync::LazyLock;
+
+use crate::clean::*;
+use crate::core::DocContext;
+use crate::html::markdown::main_body_opts;
 
 pub(super) fn visit_item(cx: &DocContext<'_>, item: &Item) {
     let Some(hir_id) = DocContext::as_local_hir_id(cx.tcx, item.item_id) else {
diff --git a/src/librustdoc/passes/lint/check_code_block_syntax.rs b/src/librustdoc/passes/lint/check_code_block_syntax.rs
index afeb7111e15..ef05befdddc 100644
--- a/src/librustdoc/passes/lint/check_code_block_syntax.rs
+++ b/src/librustdoc/passes/lint/check_code_block_syntax.rs
@@ -1,11 +1,9 @@
 //! Validates syntax inside Rust code blocks (\`\`\`rust).
 
 use rustc_data_structures::sync::{Lock, Lrc};
-use rustc_errors::{
-    emitter::Emitter,
-    translation::{to_fluent_args, Translate},
-    Applicability, DiagCtxt, DiagInner, LazyFallbackBundle,
-};
+use rustc_errors::emitter::Emitter;
+use rustc_errors::translation::{to_fluent_args, Translate};
+use rustc_errors::{Applicability, DiagCtxt, DiagInner, LazyFallbackBundle};
 use rustc_parse::{source_str_to_stream, unwrap_or_emit_fatal};
 use rustc_resolve::rustdoc::source_span_for_markdown_range;
 use rustc_session::parse::ParseSess;
diff --git a/src/librustdoc/passes/lint/html_tags.rs b/src/librustdoc/passes/lint/html_tags.rs
index 87dfa5d5389..6f9e9d36a5c 100644
--- a/src/librustdoc/passes/lint/html_tags.rs
+++ b/src/librustdoc/passes/lint/html_tags.rs
@@ -1,15 +1,15 @@
 //! Detects invalid HTML (like an unclosed `<span>`) in doc comments.
 
-use crate::clean::*;
-use crate::core::DocContext;
-use crate::html::markdown::main_body_opts;
+use std::iter::Peekable;
+use std::ops::Range;
+use std::str::CharIndices;
 
 use pulldown_cmark::{BrokenLink, Event, LinkType, Parser, Tag, TagEnd};
 use rustc_resolve::rustdoc::source_span_for_markdown_range;
 
-use std::iter::Peekable;
-use std::ops::Range;
-use std::str::CharIndices;
+use crate::clean::*;
+use crate::core::DocContext;
+use crate::html::markdown::main_body_opts;
 
 pub(crate) fn visit_item(cx: &DocContext<'_>, item: &Item) {
     let tcx = cx.tcx;
diff --git a/src/librustdoc/passes/lint/redundant_explicit_links.rs b/src/librustdoc/passes/lint/redundant_explicit_links.rs
index b36b41c9f2d..0a90c039dfb 100644
--- a/src/librustdoc/passes/lint/redundant_explicit_links.rs
+++ b/src/librustdoc/passes/lint/redundant_explicit_links.rs
@@ -12,8 +12,7 @@ use rustc_resolve::rustdoc::{prepare_to_doc_link_resolution, source_span_for_mar
 use rustc_span::def_id::DefId;
 use rustc_span::Symbol;
 
-use crate::clean::utils::find_nearest_parent_module;
-use crate::clean::utils::inherits_doc_hidden;
+use crate::clean::utils::{find_nearest_parent_module, inherits_doc_hidden};
 use crate::clean::Item;
 use crate::core::DocContext;
 use crate::html::markdown::main_body_opts;
diff --git a/src/librustdoc/passes/lint/unescaped_backticks.rs b/src/librustdoc/passes/lint/unescaped_backticks.rs
index be9670077d1..a6c8db16f82 100644
--- a/src/librustdoc/passes/lint/unescaped_backticks.rs
+++ b/src/librustdoc/passes/lint/unescaped_backticks.rs
@@ -1,13 +1,15 @@
 //! Detects unescaped backticks (\`) in doc comments.
 
-use crate::clean::Item;
-use crate::core::DocContext;
-use crate::html::markdown::main_body_opts;
+use std::ops::Range;
+
 use pulldown_cmark::{BrokenLink, Event, Parser};
 use rustc_errors::Diag;
 use rustc_lint_defs::Applicability;
 use rustc_resolve::rustdoc::source_span_for_markdown_range;
-use std::ops::Range;
+
+use crate::clean::Item;
+use crate::core::DocContext;
+use crate::html::markdown::main_body_opts;
 
 pub(crate) fn visit_item(cx: &DocContext<'_>, item: &Item) {
     let tcx = cx.tcx;
diff --git a/src/librustdoc/passes/lint/unportable_markdown.rs b/src/librustdoc/passes/lint/unportable_markdown.rs
index 5f185377634..87fe0055883 100644
--- a/src/librustdoc/passes/lint/unportable_markdown.rs
+++ b/src/librustdoc/passes/lint/unportable_markdown.rs
@@ -10,13 +10,14 @@
 //!
 //! <https://rustc-dev-guide.rust-lang.org/bug-fix-procedure.html#add-the-lint-to-the-list-of-removed-lists>
 
-use crate::clean::Item;
-use crate::core::DocContext;
-use pulldown_cmark as cmarkn;
-use pulldown_cmark_old as cmarko;
+use std::collections::{BTreeMap, BTreeSet};
+
 use rustc_lint_defs::Applicability;
 use rustc_resolve::rustdoc::source_span_for_markdown_range;
-use std::collections::{BTreeMap, BTreeSet};
+use {pulldown_cmark as cmarkn, pulldown_cmark_old as cmarko};
+
+use crate::clean::Item;
+use crate::core::DocContext;
 
 pub(crate) fn visit_item(cx: &DocContext<'_>, item: &Item) {
     let tcx = cx.tcx;
diff --git a/src/librustdoc/passes/propagate_doc_cfg.rs b/src/librustdoc/passes/propagate_doc_cfg.rs
index 8de7f2379b4..5aa6a5ee604 100644
--- a/src/librustdoc/passes/propagate_doc_cfg.rs
+++ b/src/librustdoc/passes/propagate_doc_cfg.rs
@@ -2,6 +2,8 @@
 
 use std::sync::Arc;
 
+use rustc_hir::def_id::LocalDefId;
+
 use crate::clean::cfg::Cfg;
 use crate::clean::inline::{load_attrs, merge_attrs};
 use crate::clean::{Crate, Item, ItemKind};
@@ -9,8 +11,6 @@ use crate::core::DocContext;
 use crate::fold::DocFolder;
 use crate::passes::Pass;
 
-use rustc_hir::def_id::LocalDefId;
-
 pub(crate) const PROPAGATE_DOC_CFG: Pass = Pass {
     name: "propagate-doc-cfg",
     run: propagate_doc_cfg,
diff --git a/src/librustdoc/passes/strip_aliased_non_local.rs b/src/librustdoc/passes/strip_aliased_non_local.rs
index ac7d422ec80..e1dd2d3af0f 100644
--- a/src/librustdoc/passes/strip_aliased_non_local.rs
+++ b/src/librustdoc/passes/strip_aliased_non_local.rs
@@ -1,5 +1,4 @@
-use rustc_middle::ty::TyCtxt;
-use rustc_middle::ty::Visibility;
+use rustc_middle::ty::{TyCtxt, Visibility};
 
 use crate::clean;
 use crate::clean::Item;
diff --git a/src/librustdoc/passes/strip_hidden.rs b/src/librustdoc/passes/strip_hidden.rs
index 81a90ed498a..faf42b3aab1 100644
--- a/src/librustdoc/passes/strip_hidden.rs
+++ b/src/librustdoc/passes/strip_hidden.rs
@@ -1,9 +1,10 @@
 //! Strip all doc(hidden) items from the output.
 
+use std::mem;
+
 use rustc_hir::def_id::LocalDefId;
 use rustc_middle::ty::TyCtxt;
 use rustc_span::symbol::sym;
-use std::mem;
 
 use crate::clean;
 use crate::clean::utils::inherits_doc_hidden;
diff --git a/src/librustdoc/passes/stripper.rs b/src/librustdoc/passes/stripper.rs
index 1cf80a0d80c..d3368186d3a 100644
--- a/src/librustdoc/passes/stripper.rs
+++ b/src/librustdoc/passes/stripper.rs
@@ -1,8 +1,9 @@
 //! A collection of utility functions for the `strip_*` passes.
 
+use std::mem;
+
 use rustc_hir::def_id::DefId;
 use rustc_middle::ty::{TyCtxt, Visibility};
-use std::mem;
 
 use crate::clean::utils::inherits_doc_hidden;
 use crate::clean::{self, Item, ItemId, ItemIdSet};
diff --git a/src/librustdoc/scrape_examples.rs b/src/librustdoc/scrape_examples.rs
index 5a595e03953..f001fb26b81 100644
--- a/src/librustdoc/scrape_examples.rs
+++ b/src/librustdoc/scrape_examples.rs
@@ -1,35 +1,27 @@
 //! This module analyzes crates to find call sites that can serve as examples in the documentation.
 
-use crate::clean;
-use crate::config;
-use crate::formats;
-use crate::formats::renderer::FormatRenderer;
-use crate::html::render::Context;
+use std::fs;
+use std::path::PathBuf;
 
 use rustc_data_structures::fx::FxHashMap;
 use rustc_errors::DiagCtxtHandle;
-use rustc_hir::{
-    self as hir,
-    intravisit::{self, Visitor},
-};
+use rustc_hir::intravisit::{self, Visitor};
+use rustc_hir::{self as hir};
 use rustc_interface::interface;
 use rustc_macros::{Decodable, Encodable};
 use rustc_middle::hir::map::Map;
 use rustc_middle::hir::nested_filter;
 use rustc_middle::ty::{self, TyCtxt};
-use rustc_serialize::{
-    opaque::{FileEncoder, MemDecoder},
-    Decodable, Encodable,
-};
+use rustc_serialize::opaque::{FileEncoder, MemDecoder};
+use rustc_serialize::{Decodable, Encodable};
 use rustc_session::getopts;
-use rustc_span::{
-    def_id::{CrateNum, DefPathHash, LOCAL_CRATE},
-    edition::Edition,
-    BytePos, FileName, SourceFile,
-};
+use rustc_span::def_id::{CrateNum, DefPathHash, LOCAL_CRATE};
+use rustc_span::edition::Edition;
+use rustc_span::{BytePos, FileName, SourceFile};
 
-use std::fs;
-use std::path::PathBuf;
+use crate::formats::renderer::FormatRenderer;
+use crate::html::render::Context;
+use crate::{clean, config, formats};
 
 #[derive(Debug, Clone)]
 pub(crate) struct ScrapeExamplesOptions {
diff --git a/src/librustdoc/theme.rs b/src/librustdoc/theme.rs
index 2fa54a9cd81..409728a8e86 100644
--- a/src/librustdoc/theme.rs
+++ b/src/librustdoc/theme.rs
@@ -1,10 +1,10 @@
-use rustc_data_structures::fx::FxHashMap;
 use std::collections::hash_map::Entry;
 use std::fs;
 use std::iter::Peekable;
 use std::path::Path;
 use std::str::Chars;
 
+use rustc_data_structures::fx::FxHashMap;
 use rustc_errors::DiagCtxtHandle;
 
 #[cfg(test)]
diff --git a/src/librustdoc/visit_ast.rs b/src/librustdoc/visit_ast.rs
index 886df82e5b6..d7a4a0d88ac 100644
--- a/src/librustdoc/visit_ast.rs
+++ b/src/librustdoc/visit_ast.rs
@@ -1,6 +1,8 @@
 //! The Rust AST Visitor. Extracts useful information and massages it into a form
 //! usable for `clean`.
 
+use std::mem;
+
 use rustc_data_structures::fx::{FxHashSet, FxIndexMap};
 use rustc_hir as hir;
 use rustc_hir::def::{DefKind, Res};
@@ -14,10 +16,9 @@ use rustc_span::hygiene::MacroKind;
 use rustc_span::symbol::{kw, sym, Symbol};
 use rustc_span::Span;
 
-use std::mem;
-
+use crate::clean::cfg::Cfg;
 use crate::clean::utils::{inherits_doc_hidden, should_ignore_res};
-use crate::clean::{cfg::Cfg, reexport_chain, AttributesExt, NestedAttributesExt};
+use crate::clean::{reexport_chain, AttributesExt, NestedAttributesExt};
 use crate::core;
 
 /// This module is used to store stuff from Rust's AST in a more convenient
diff --git a/src/librustdoc/visit_lib.rs b/src/librustdoc/visit_lib.rs
index 82c97466111..3e66ed9f56d 100644
--- a/src/librustdoc/visit_lib.rs
+++ b/src/librustdoc/visit_lib.rs
@@ -1,8 +1,9 @@
-use crate::core::DocContext;
 use rustc_hir::def::DefKind;
 use rustc_hir::def_id::{DefId, DefIdSet};
 use rustc_middle::ty::TyCtxt;
 
+use crate::core::DocContext;
+
 // FIXME: this may not be exhaustive, but is sufficient for rustdocs current uses
 
 #[derive(Default)]
diff --git a/src/rustdoc-json-types/lib.rs b/src/rustdoc-json-types/lib.rs
index 6fd23b60c8a..f67fdaac042 100644
--- a/src/rustdoc-json-types/lib.rs
+++ b/src/rustdoc-json-types/lib.rs
@@ -3,9 +3,10 @@
 //! These types are the public API exposed through the `--output-format json` flag. The [`Crate`]
 //! struct is the root of the JSON blob and all other items are contained within.
 
+use std::path::PathBuf;
+
 use rustc_hash::FxHashMap;
 use serde::{Deserialize, Serialize};
-use std::path::PathBuf;
 
 /// rustdoc format-version.
 pub const FORMAT_VERSION: u32 = 32;
diff --git a/src/tools/build-manifest/src/checksum.rs b/src/tools/build-manifest/src/checksum.rs
index c019c7a2f7a..c69b4180d92 100644
--- a/src/tools/build-manifest/src/checksum.rs
+++ b/src/tools/build-manifest/src/checksum.rs
@@ -1,6 +1,3 @@
-use crate::manifest::{FileHash, Manifest};
-use rayon::prelude::*;
-use sha2::{Digest, Sha256};
 use std::collections::{HashMap, HashSet};
 use std::error::Error;
 use std::fs::File;
@@ -9,6 +6,11 @@ use std::path::{Path, PathBuf};
 use std::sync::Mutex;
 use std::time::Instant;
 
+use rayon::prelude::*;
+use sha2::{Digest, Sha256};
+
+use crate::manifest::{FileHash, Manifest};
+
 pub(crate) struct Checksums {
     cache_path: Option<PathBuf>,
     collected: Mutex<HashMap<PathBuf, String>>,
diff --git a/src/tools/build-manifest/src/main.rs b/src/tools/build-manifest/src/main.rs
index e0bea5f053d..ff475b9571b 100644
--- a/src/tools/build-manifest/src/main.rs
+++ b/src/tools/build-manifest/src/main.rs
@@ -4,13 +4,13 @@ mod checksum;
 mod manifest;
 mod versions;
 
+use std::collections::{BTreeMap, HashSet};
+use std::path::{Path, PathBuf};
+use std::{env, fs};
+
 use crate::checksum::Checksums;
 use crate::manifest::{Component, Manifest, Package, Rename, Target};
 use crate::versions::{PkgType, Versions};
-use std::collections::{BTreeMap, HashSet};
-use std::env;
-use std::fs;
-use std::path::{Path, PathBuf};
 
 static HOSTS: &[&str] = &[
     "aarch64-apple-darwin",
diff --git a/src/tools/build-manifest/src/manifest.rs b/src/tools/build-manifest/src/manifest.rs
index 6fa4f83e415..695a8f5d4e7 100644
--- a/src/tools/build-manifest/src/manifest.rs
+++ b/src/tools/build-manifest/src/manifest.rs
@@ -1,9 +1,11 @@
-use crate::versions::PkgType;
-use crate::Builder;
-use serde::{Serialize, Serializer};
 use std::collections::BTreeMap;
 use std::path::{Path, PathBuf};
 
+use serde::{Serialize, Serializer};
+
+use crate::versions::PkgType;
+use crate::Builder;
+
 #[derive(Serialize)]
 #[serde(rename_all = "kebab-case")]
 pub(crate) struct Manifest {
diff --git a/src/tools/build-manifest/src/versions.rs b/src/tools/build-manifest/src/versions.rs
index 233a2670ed2..495cab582eb 100644
--- a/src/tools/build-manifest/src/versions.rs
+++ b/src/tools/build-manifest/src/versions.rs
@@ -1,9 +1,10 @@
-use anyhow::Error;
-use flate2::read::GzDecoder;
 use std::collections::HashMap;
 use std::fs::File;
 use std::io::Read;
 use std::path::{Path, PathBuf};
+
+use anyhow::Error;
+use flate2::read::GzDecoder;
 use tar::Archive;
 use xz2::read::XzDecoder;
 
@@ -100,9 +101,10 @@ impl PkgType {
     }
 
     pub(crate) fn targets(&self) -> &[&str] {
-        use crate::{HOSTS, MINGW, TARGETS};
         use PkgType::*;
 
+        use crate::{HOSTS, MINGW, TARGETS};
+
         match self {
             Rust => HOSTS, // doesn't matter in practice, but return something to avoid panicking
             Rustc => HOSTS,
diff --git a/src/tools/build_helper/src/git.rs b/src/tools/build_helper/src/git.rs
index 8be38dc855f..da84569c778 100644
--- a/src/tools/build_helper/src/git.rs
+++ b/src/tools/build_helper/src/git.rs
@@ -1,5 +1,5 @@
-use std::process::Stdio;
-use std::{path::Path, process::Command};
+use std::path::Path;
+use std::process::{Command, Stdio};
 
 pub struct GitConfig<'a> {
     pub git_repository: &'a str,
diff --git a/src/tools/bump-stage0/src/main.rs b/src/tools/bump-stage0/src/main.rs
index bb06e113c0e..fed225f2f2d 100644
--- a/src/tools/bump-stage0/src/main.rs
+++ b/src/tools/bump-stage0/src/main.rs
@@ -1,10 +1,11 @@
 #![deny(unused_variables)]
 
+use std::collections::HashMap;
+
 use anyhow::{Context, Error};
 use build_helper::stage0_parser::{parse_stage0_file, Stage0Config, VersionMetadata};
 use curl::easy::Easy;
 use indexmap::IndexMap;
-use std::collections::HashMap;
 
 const PATH: &str = "src/stage0";
 const COMPILER_COMPONENTS: &[&str] = &["rustc", "rust-std", "cargo", "clippy-preview"];
diff --git a/src/tools/cargotest/main.rs b/src/tools/cargotest/main.rs
index a5d2ffb1572..4c57683806e 100644
--- a/src/tools/cargotest/main.rs
+++ b/src/tools/cargotest/main.rs
@@ -1,7 +1,6 @@
-use std::env;
-use std::fs;
 use std::path::{Path, PathBuf};
 use std::process::Command;
+use std::{env, fs};
 
 struct Test {
     repo: &'static str,
diff --git a/src/tools/collect-license-metadata/src/main.rs b/src/tools/collect-license-metadata/src/main.rs
index ca2a6f4b8c8..ca6aa01d78c 100644
--- a/src/tools/collect-license-metadata/src/main.rs
+++ b/src/tools/collect-license-metadata/src/main.rs
@@ -2,10 +2,12 @@ mod licenses;
 mod path_tree;
 mod reuse;
 
-use crate::licenses::LicensesInterner;
-use anyhow::Error;
 use std::path::PathBuf;
 
+use anyhow::Error;
+
+use crate::licenses::LicensesInterner;
+
 fn main() -> Result<(), Error> {
     let reuse_exe: PathBuf = std::env::var_os("REUSE_EXE").expect("Missing REUSE_EXE").into();
     let dest: PathBuf = std::env::var_os("DEST").expect("Missing DEST").into();
diff --git a/src/tools/collect-license-metadata/src/path_tree.rs b/src/tools/collect-license-metadata/src/path_tree.rs
index b27fb7f9225..866a4e42aab 100644
--- a/src/tools/collect-license-metadata/src/path_tree.rs
+++ b/src/tools/collect-license-metadata/src/path_tree.rs
@@ -3,10 +3,11 @@
 //! responsible for that, by turning the list of paths into a tree and executing simplification
 //! passes over the tree to remove redundant information.
 
-use crate::licenses::{License, LicenseId, LicensesInterner};
 use std::collections::BTreeMap;
 use std::path::{Path, PathBuf};
 
+use crate::licenses::{License, LicenseId, LicensesInterner};
+
 #[derive(serde::Serialize)]
 #[serde(rename_all = "kebab-case", tag = "type")]
 pub(crate) enum Node<L> {
diff --git a/src/tools/collect-license-metadata/src/reuse.rs b/src/tools/collect-license-metadata/src/reuse.rs
index a5d01935f76..e5ee8f0da5e 100644
--- a/src/tools/collect-license-metadata/src/reuse.rs
+++ b/src/tools/collect-license-metadata/src/reuse.rs
@@ -1,9 +1,11 @@
-use crate::licenses::{License, LicenseId, LicensesInterner};
-use anyhow::Error;
 use std::path::{Path, PathBuf};
 use std::process::{Command, Stdio};
 use std::time::Instant;
 
+use anyhow::Error;
+
+use crate::licenses::{License, LicenseId, LicensesInterner};
+
 pub(crate) fn collect(
     reuse_exe: &Path,
     interner: &mut LicensesInterner,
diff --git a/src/tools/compiletest/src/common.rs b/src/tools/compiletest/src/common.rs
index bc66dcbfb94..70ebefe3f41 100644
--- a/src/tools/compiletest/src/common.rs
+++ b/src/tools/compiletest/src/common.rs
@@ -1,19 +1,18 @@
-pub use self::Mode::*;
-
+use std::collections::{HashMap, HashSet};
 use std::ffi::OsString;
-use std::fmt;
-use std::iter;
 use std::path::{Path, PathBuf};
 use std::process::Command;
 use std::str::FromStr;
 use std::sync::OnceLock;
+use std::{fmt, iter};
 
-use crate::util::{add_dylib_path, PathBufExt};
 use build_helper::git::GitConfig;
 use serde::de::{Deserialize, Deserializer, Error as _};
-use std::collections::{HashMap, HashSet};
 use test::{ColorConfig, OutputFormat};
 
+pub use self::Mode::*;
+use crate::util::{add_dylib_path, PathBufExt};
+
 macro_rules! string_enum {
     ($(#[$meta:meta])* $vis:vis enum $name:ident { $($variant:ident => $repr:expr,)* }) => {
         $(#[$meta])*
diff --git a/src/tools/compiletest/src/errors.rs b/src/tools/compiletest/src/errors.rs
index 7a5abc51d04..4ca9f02ddc7 100644
--- a/src/tools/compiletest/src/errors.rs
+++ b/src/tools/compiletest/src/errors.rs
@@ -1,5 +1,3 @@
-use self::WhichLine::*;
-
 use std::fmt;
 use std::fs::File;
 use std::io::prelude::*;
@@ -11,6 +9,8 @@ use std::sync::OnceLock;
 use regex::Regex;
 use tracing::*;
 
+use self::WhichLine::*;
+
 #[derive(Copy, Clone, Debug, PartialEq)]
 pub enum ErrorKind {
     Help,
diff --git a/src/tools/compiletest/src/header.rs b/src/tools/compiletest/src/header.rs
index 3afb5e27547..0208ed34ac1 100644
--- a/src/tools/compiletest/src/header.rs
+++ b/src/tools/compiletest/src/header.rs
@@ -11,8 +11,7 @@ use regex::Regex;
 use tracing::*;
 
 use crate::common::{Config, Debugger, FailMode, Mode, PassMode};
-use crate::header::cfg::parse_cfg_name_directive;
-use crate::header::cfg::MatchOutcome;
+use crate::header::cfg::{parse_cfg_name_directive, MatchOutcome};
 use crate::header::needs::CachedNeedsConditions;
 use crate::util::static_regex;
 use crate::{extract_cdb_version, extract_gdb_version};
diff --git a/src/tools/compiletest/src/header/cfg.rs b/src/tools/compiletest/src/header/cfg.rs
index 522c52b1de2..948568e63c2 100644
--- a/src/tools/compiletest/src/header/cfg.rs
+++ b/src/tools/compiletest/src/header/cfg.rs
@@ -1,6 +1,7 @@
+use std::collections::HashSet;
+
 use crate::common::{CompareMode, Config, Debugger, Mode};
 use crate::header::IgnoreDecision;
-use std::collections::HashSet;
 
 const EXTRA_ARCHS: &[&str] = &["spirv"];
 
diff --git a/src/tools/compiletest/src/header/tests.rs b/src/tools/compiletest/src/header/tests.rs
index c790eb18d67..29e11e77f1c 100644
--- a/src/tools/compiletest/src/header/tests.rs
+++ b/src/tools/compiletest/src/header/tests.rs
@@ -2,11 +2,10 @@ use std::io::Read;
 use std::path::Path;
 use std::str::FromStr;
 
+use super::iter_header;
 use crate::common::{Config, Debugger, Mode};
 use crate::header::{parse_normalize_rule, EarlyProps, HeadersCache};
 
-use super::iter_header;
-
 fn make_test_description<R: Read>(
     config: &Config,
     name: test::TestName,
diff --git a/src/tools/compiletest/src/json.rs b/src/tools/compiletest/src/json.rs
index 29e8809e5bd..76b83f02b14 100644
--- a/src/tools/compiletest/src/json.rs
+++ b/src/tools/compiletest/src/json.rs
@@ -1,12 +1,14 @@
 //! These structs are a subset of the ones found in `rustc_errors::json`.
 //! They are only used for deserialization of JSON output provided by libtest.
 
-use crate::errors::{Error, ErrorKind};
-use crate::runtest::ProcRes;
-use serde::Deserialize;
 use std::path::{Path, PathBuf};
 use std::str::FromStr;
 
+use serde::Deserialize;
+
+use crate::errors::{Error, ErrorKind};
+use crate::runtest::ProcRes;
+
 #[derive(Deserialize)]
 struct Diagnostic {
     message: String,
diff --git a/src/tools/compiletest/src/lib.rs b/src/tools/compiletest/src/lib.rs
index 81a5acb5cf2..6acf46f9196 100644
--- a/src/tools/compiletest/src/lib.rs
+++ b/src/tools/compiletest/src/lib.rs
@@ -18,27 +18,29 @@ mod read2;
 pub mod runtest;
 pub mod util;
 
-use crate::common::{expected_output_path, output_base_dir, output_relative_path, UI_EXTENSIONS};
-use crate::common::{Config, Debugger, Mode, PassMode, TestPaths};
-use crate::util::logv;
-use build_helper::git::{get_git_modified_files, get_git_untracked_files};
 use core::panic;
-use getopts::Options;
 use std::collections::HashSet;
 use std::ffi::{OsStr, OsString};
-use std::fs;
 use std::io::{self, ErrorKind};
 use std::path::{Path, PathBuf};
 use std::process::{Command, Stdio};
 use std::sync::{Arc, OnceLock};
 use std::time::SystemTime;
-use std::{env, vec};
+use std::{env, fs, vec};
+
+use build_helper::git::{get_git_modified_files, get_git_untracked_files};
+use getopts::Options;
 use test::ColorConfig;
 use tracing::*;
 use walkdir::WalkDir;
 
 use self::header::{make_test_description, EarlyProps};
+use crate::common::{
+    expected_output_path, output_base_dir, output_relative_path, Config, Debugger, Mode, PassMode,
+    TestPaths, UI_EXTENSIONS,
+};
 use crate::header::HeadersCache;
+use crate::util::logv;
 
 pub fn parse_config(args: Vec<String>) -> Config {
     let mut opts = Options::new();
diff --git a/src/tools/compiletest/src/main.rs b/src/tools/compiletest/src/main.rs
index 1ec3f0a0552..7b85e6f80b3 100644
--- a/src/tools/compiletest/src/main.rs
+++ b/src/tools/compiletest/src/main.rs
@@ -1,6 +1,9 @@
-use std::{env, io::IsTerminal, sync::Arc};
+use std::env;
+use std::io::IsTerminal;
+use std::sync::Arc;
 
-use compiletest::{common::Mode, log_config, parse_config, run_tests};
+use compiletest::common::Mode;
+use compiletest::{log_config, parse_config, run_tests};
 
 fn main() {
     tracing_subscriber::fmt::init();
diff --git a/src/tools/compiletest/src/raise_fd_limit.rs b/src/tools/compiletest/src/raise_fd_limit.rs
index 218bea68a21..4445ecb7ce8 100644
--- a/src/tools/compiletest/src/raise_fd_limit.rs
+++ b/src/tools/compiletest/src/raise_fd_limit.rs
@@ -7,10 +7,9 @@
 #[cfg(target_vendor = "apple")]
 #[allow(non_camel_case_types)]
 pub unsafe fn raise_fd_limit() {
-    use std::cmp;
-    use std::io;
     use std::mem::size_of_val;
     use std::ptr::null_mut;
+    use std::{cmp, io};
 
     static CTL_KERN: libc::c_int = 1;
     static KERN_MAXFILESPERPROC: libc::c_int = 29;
diff --git a/src/tools/compiletest/src/read2.rs b/src/tools/compiletest/src/read2.rs
index 8c06339f3c3..b2d068e78b4 100644
--- a/src/tools/compiletest/src/read2.rs
+++ b/src/tools/compiletest/src/read2.rs
@@ -4,10 +4,11 @@
 #[cfg(test)]
 mod tests;
 
-pub use self::imp::read2;
 use std::io::{self, Write};
 use std::process::{Child, Output};
 
+pub use self::imp::read2;
+
 #[derive(Copy, Clone, Debug)]
 pub enum Truncated {
     Yes,
@@ -154,11 +155,10 @@ mod imp {
 
 #[cfg(unix)]
 mod imp {
-    use std::io;
     use std::io::prelude::*;
-    use std::mem;
     use std::os::unix::prelude::*;
     use std::process::{ChildStderr, ChildStdout};
+    use std::{io, mem};
 
     pub fn read2(
         mut out_pipe: ChildStdout,
@@ -228,10 +228,9 @@ mod imp {
 
 #[cfg(windows)]
 mod imp {
-    use std::io;
     use std::os::windows::prelude::*;
     use std::process::{ChildStderr, ChildStdout};
-    use std::slice;
+    use std::{io, slice};
 
     use miow::iocp::{CompletionPort, CompletionStatus};
     use miow::pipe::NamedPipe;
diff --git a/src/tools/compiletest/src/runtest.rs b/src/tools/compiletest/src/runtest.rs
index 78c06551ff2..f6e8fdd6244 100644
--- a/src/tools/compiletest/src/runtest.rs
+++ b/src/tools/compiletest/src/runtest.rs
@@ -1,45 +1,37 @@
 // ignore-tidy-filelength
 
-use crate::common::{
-    expected_output_path, UI_EXTENSIONS, UI_FIXED, UI_STDERR, UI_STDOUT, UI_SVG, UI_WINDOWS_SVG,
-};
-use crate::common::{incremental_dir, output_base_dir, output_base_name, output_testname_unique};
-use crate::common::{Assembly, Crashes, Incremental, JsDocTest, MirOpt, RunMake, RustdocJson, Ui};
-use crate::common::{Codegen, CodegenUnits, DebugInfo, Debugger, Rustdoc};
-use crate::common::{CompareMode, FailMode, PassMode};
-use crate::common::{Config, TestPaths};
-use crate::common::{CoverageMap, CoverageRun, Pretty, RunPassValgrind};
-use crate::common::{UI_RUN_STDERR, UI_RUN_STDOUT};
-use crate::compute_diff::{write_diff, write_filtered_diff};
-use crate::errors::{self, Error, ErrorKind};
-use crate::header::TestProps;
-use crate::json;
-use crate::read2::{read2_abbreviated, Truncated};
-use crate::util::{add_dylib_path, copy_dir_all, dylib_env_var, logv, static_regex, PathBufExt};
-use crate::ColorConfig;
-use colored::Colorize;
-use miropt_test_tools::{files_for_miropt_test, MiroptTest, MiroptTestFile};
-use regex::{Captures, Regex};
-use rustfix::{apply_suggestions, get_suggestions_from_json, Filter};
 use std::collections::{HashMap, HashSet};
-use std::env;
 use std::ffi::{OsStr, OsString};
 use std::fs::{self, create_dir_all, File, OpenOptions};
 use std::hash::{DefaultHasher, Hash, Hasher};
 use std::io::prelude::*;
 use std::io::{self, BufReader};
-use std::iter;
 use std::path::{Path, PathBuf};
 use std::process::{Child, Command, ExitStatus, Output, Stdio};
-use std::str;
 use std::sync::Arc;
+use std::{env, iter, str};
 
 use anyhow::Context;
+use colored::Colorize;
 use glob::glob;
+use miropt_test_tools::{files_for_miropt_test, MiroptTest, MiroptTestFile};
+use regex::{Captures, Regex};
+use rustfix::{apply_suggestions, get_suggestions_from_json, Filter};
 use tracing::*;
 
-use crate::extract_gdb_version;
-use crate::is_android_gdb_target;
+use crate::common::{
+    expected_output_path, incremental_dir, output_base_dir, output_base_name,
+    output_testname_unique, Assembly, Codegen, CodegenUnits, CompareMode, Config, CoverageMap,
+    CoverageRun, Crashes, DebugInfo, Debugger, FailMode, Incremental, JsDocTest, MirOpt, PassMode,
+    Pretty, RunMake, RunPassValgrind, Rustdoc, RustdocJson, TestPaths, Ui, UI_EXTENSIONS, UI_FIXED,
+    UI_RUN_STDERR, UI_RUN_STDOUT, UI_STDERR, UI_STDOUT, UI_SVG, UI_WINDOWS_SVG,
+};
+use crate::compute_diff::{write_diff, write_filtered_diff};
+use crate::errors::{self, Error, ErrorKind};
+use crate::header::TestProps;
+use crate::read2::{read2_abbreviated, Truncated};
+use crate::util::{add_dylib_path, copy_dir_all, dylib_env_var, logv, static_regex, PathBufExt};
+use crate::{extract_gdb_version, is_android_gdb_target, json, ColorConfig};
 
 mod coverage;
 mod debugger;
diff --git a/src/tools/compiletest/src/runtest/debugger.rs b/src/tools/compiletest/src/runtest/debugger.rs
index ed6cc97a8ab..985fe6381e8 100644
--- a/src/tools/compiletest/src/runtest/debugger.rs
+++ b/src/tools/compiletest/src/runtest/debugger.rs
@@ -1,12 +1,12 @@
-use crate::common::Config;
-use crate::header::line_directive;
-use crate::runtest::ProcRes;
-
 use std::fmt::Write;
 use std::fs::File;
 use std::io::{BufRead, BufReader};
 use std::path::{Path, PathBuf};
 
+use crate::common::Config;
+use crate::header::line_directive;
+use crate::runtest::ProcRes;
+
 /// Representation of information to invoke a debugger and check its output
 pub(super) struct DebuggerCommands {
     /// Commands for the debuuger
diff --git a/src/tools/compiletest/src/util.rs b/src/tools/compiletest/src/util.rs
index cdec49a51d7..bff02f1db9f 100644
--- a/src/tools/compiletest/src/util.rs
+++ b/src/tools/compiletest/src/util.rs
@@ -1,4 +1,3 @@
-use crate::common::Config;
 use std::env;
 use std::ffi::OsStr;
 use std::path::{Path, PathBuf};
@@ -6,6 +5,8 @@ use std::process::Command;
 
 use tracing::*;
 
+use crate::common::Config;
+
 #[cfg(test)]
 mod tests;
 
diff --git a/src/tools/coverage-dump/src/covfun.rs b/src/tools/coverage-dump/src/covfun.rs
index b308c8de14f..4729b327de5 100644
--- a/src/tools/coverage-dump/src/covfun.rs
+++ b/src/tools/coverage-dump/src/covfun.rs
@@ -1,10 +1,12 @@
-use crate::parser::{unescape_llvm_string_contents, Parser};
-use anyhow::{anyhow, Context};
-use regex::Regex;
 use std::collections::HashMap;
 use std::fmt::{self, Debug, Write as _};
 use std::sync::OnceLock;
 
+use anyhow::{anyhow, Context};
+use regex::Regex;
+
+use crate::parser::{unescape_llvm_string_contents, Parser};
+
 pub(crate) fn dump_covfun_mappings(
     llvm_ir: &str,
     function_names: &HashMap<u64, String>,
diff --git a/src/tools/coverage-dump/src/parser.rs b/src/tools/coverage-dump/src/parser.rs
index eefac1a4f94..0bd4abdae3e 100644
--- a/src/tools/coverage-dump/src/parser.rs
+++ b/src/tools/coverage-dump/src/parser.rs
@@ -1,9 +1,10 @@
 #[cfg(test)]
 mod tests;
 
+use std::sync::OnceLock;
+
 use anyhow::ensure;
 use regex::bytes;
-use std::sync::OnceLock;
 
 /// Given the raw contents of a string literal in LLVM IR assembly, decodes any
 /// backslash escapes and returns a vector containing the resulting byte string.
diff --git a/src/tools/coverage-dump/src/prf_names.rs b/src/tools/coverage-dump/src/prf_names.rs
index d3f7b819e48..c5f9c4ce54c 100644
--- a/src/tools/coverage-dump/src/prf_names.rs
+++ b/src/tools/coverage-dump/src/prf_names.rs
@@ -1,9 +1,11 @@
-use crate::parser::{unescape_llvm_string_contents, Parser};
-use anyhow::{anyhow, ensure};
-use regex::Regex;
 use std::collections::HashMap;
 use std::sync::OnceLock;
 
+use anyhow::{anyhow, ensure};
+use regex::Regex;
+
+use crate::parser::{unescape_llvm_string_contents, Parser};
+
 /// Scans through the contents of an LLVM IR assembly file to find `__llvm_prf_names`
 /// entries, decodes them, and creates a table that maps name hash values to
 /// (demangled) function names.
diff --git a/src/tools/error_index_generator/main.rs b/src/tools/error_index_generator/main.rs
index 2de2d959a95..53a26112911 100644
--- a/src/tools/error_index_generator/main.rs
+++ b/src/tools/error_index_generator/main.rs
@@ -5,18 +5,16 @@ extern crate rustc_log;
 extern crate rustc_session;
 
 extern crate rustc_errors;
-use rustc_errors::codes::DIAGNOSTICS;
-
 use std::env;
 use std::error::Error;
 use std::fs::{self, File};
 use std::io::Write;
-use std::path::Path;
-use std::path::PathBuf;
+use std::path::{Path, PathBuf};
 use std::str::FromStr;
 
 use mdbook::book::{parse_summary, BookItem, Chapter};
 use mdbook::{Config, MDBook};
+use rustc_errors::codes::DIAGNOSTICS;
 
 enum OutputFormat {
     HTML,
diff --git a/src/tools/generate-copyright/src/main.rs b/src/tools/generate-copyright/src/main.rs
index d91b258162e..dce1a558697 100644
--- a/src/tools/generate-copyright/src/main.rs
+++ b/src/tools/generate-copyright/src/main.rs
@@ -1,7 +1,8 @@
-use anyhow::Error;
 use std::io::Write;
 use std::path::PathBuf;
 
+use anyhow::Error;
+
 fn main() -> Result<(), Error> {
     let dest = env_path("DEST")?;
     let license_metadata = env_path("LICENSE_METADATA")?;
diff --git a/src/tools/generate-windows-sys/src/main.rs b/src/tools/generate-windows-sys/src/main.rs
index 90fce2b675a..fe1b1bd5ceb 100644
--- a/src/tools/generate-windows-sys/src/main.rs
+++ b/src/tools/generate-windows-sys/src/main.rs
@@ -1,8 +1,7 @@
-use std::env;
 use std::error::Error;
-use std::fs;
 use std::io::{Read, Seek, SeekFrom, Write};
 use std::path::PathBuf;
+use std::{env, fs};
 
 /// 32-bit ARM is not supported by Microsoft so ARM types are not generated.
 /// Therefore we need to inject a few types to make the bindings work.
diff --git a/src/tools/html-checker/main.rs b/src/tools/html-checker/main.rs
index e74f72608ef..ecfbb1955e7 100644
--- a/src/tools/html-checker/main.rs
+++ b/src/tools/html-checker/main.rs
@@ -1,8 +1,9 @@
-use rayon::iter::{ParallelBridge, ParallelIterator};
 use std::env;
 use std::path::Path;
 use std::process::{Command, Output};
 
+use rayon::iter::{ParallelBridge, ParallelIterator};
+
 fn check_html_file(file: &Path) -> usize {
     let to_mute = &[
         // "disabled" on <link> or "autocomplete" on <select> emit this warning
diff --git a/src/tools/jsondocck/src/cache.rs b/src/tools/jsondocck/src/cache.rs
index 5f72bd171a1..9f95f9fb408 100644
--- a/src/tools/jsondocck/src/cache.rs
+++ b/src/tools/jsondocck/src/cache.rs
@@ -1,9 +1,10 @@
-use crate::config::Config;
-use serde_json::Value;
 use std::collections::HashMap;
 use std::path::Path;
 
 use fs_err as fs;
+use serde_json::Value;
+
+use crate::config::Config;
 
 #[derive(Debug)]
 pub struct Cache {
diff --git a/src/tools/jsondocck/src/error.rs b/src/tools/jsondocck/src/error.rs
index 53b9af2874b..c4cd79a64fd 100644
--- a/src/tools/jsondocck/src/error.rs
+++ b/src/tools/jsondocck/src/error.rs
@@ -1,7 +1,8 @@
-use crate::Command;
 use std::error::Error;
 use std::fmt;
 
+use crate::Command;
+
 #[derive(Debug)]
 pub enum CkError {
     /// A check failed. File didn't exist or failed to match the command
diff --git a/src/tools/jsondocck/src/main.rs b/src/tools/jsondocck/src/main.rs
index de94990b53e..b264405ac3e 100644
--- a/src/tools/jsondocck/src/main.rs
+++ b/src/tools/jsondocck/src/main.rs
@@ -1,10 +1,11 @@
-use jsonpath_lib::select;
-use regex::{Regex, RegexBuilder};
-use serde_json::Value;
 use std::borrow::Cow;
 use std::sync::OnceLock;
 use std::{env, fmt, fs};
 
+use jsonpath_lib::select;
+use regex::{Regex, RegexBuilder};
+use serde_json::Value;
+
 mod cache;
 mod config;
 mod error;
diff --git a/src/tools/jsondoclint/src/validator.rs b/src/tools/jsondoclint/src/validator.rs
index ea1e573384b..6d790c52174 100644
--- a/src/tools/jsondoclint/src/validator.rs
+++ b/src/tools/jsondoclint/src/validator.rs
@@ -9,7 +9,8 @@ use rustdoc_json_types::{
 };
 use serde_json::Value;
 
-use crate::{item_kind::Kind, json_find, Error, ErrorKind};
+use crate::item_kind::Kind;
+use crate::{json_find, Error, ErrorKind};
 
 // This is a rustc implementation detail that we rely on here
 const LOCAL_CRATE_ID: u32 = 0;
diff --git a/src/tools/jsondoclint/src/validator/tests.rs b/src/tools/jsondoclint/src/validator/tests.rs
index ba0fe11ea26..f28702de06d 100644
--- a/src/tools/jsondoclint/src/validator/tests.rs
+++ b/src/tools/jsondoclint/src/validator/tests.rs
@@ -1,9 +1,8 @@
 use rustc_hash::FxHashMap;
 use rustdoc_json_types::{Item, ItemKind, Visibility, FORMAT_VERSION};
 
-use crate::json_find::SelectorPart;
-
 use super::*;
+use crate::json_find::SelectorPart;
 
 #[track_caller]
 fn check(krate: &Crate, errs: &[Error]) {
diff --git a/src/tools/linkchecker/main.rs b/src/tools/linkchecker/main.rs
index 72ae3ed26e8..72448c1180a 100644
--- a/src/tools/linkchecker/main.rs
+++ b/src/tools/linkchecker/main.rs
@@ -14,18 +14,18 @@
 //! A few exceptions are allowed as there's known bugs in rustdoc, but this
 //! should catch the majority of "broken link" cases.
 
-use html5ever::tendril::ByteTendril;
-use html5ever::tokenizer::{
-    BufferQueue, TagToken, Token, TokenSink, TokenSinkResult, Tokenizer, TokenizerOpts,
-};
 use std::cell::RefCell;
 use std::collections::{HashMap, HashSet};
-use std::env;
-use std::fs;
 use std::io::ErrorKind;
 use std::path::{Component, Path, PathBuf};
 use std::rc::Rc;
 use std::time::Instant;
+use std::{env, fs};
+
+use html5ever::tendril::ByteTendril;
+use html5ever::tokenizer::{
+    BufferQueue, TagToken, Token, TokenSink, TokenSinkResult, Tokenizer, TokenizerOpts,
+};
 
 // Add linkcheck exceptions here
 // If at all possible you should use intra-doc links to avoid linkcheck issues. These
diff --git a/src/tools/lint-docs/src/groups.rs b/src/tools/lint-docs/src/groups.rs
index 0d827ab2e72..78d4f87ed0d 100644
--- a/src/tools/lint-docs/src/groups.rs
+++ b/src/tools/lint-docs/src/groups.rs
@@ -1,10 +1,11 @@
-use crate::{Lint, LintExtractor};
 use std::collections::{BTreeMap, BTreeSet};
 use std::error::Error;
 use std::fmt::Write;
 use std::fs;
 use std::process::Command;
 
+use crate::{Lint, LintExtractor};
+
 /// Descriptions of rustc lint groups.
 static GROUP_DESCRIPTIONS: &[(&str, &str)] = &[
     ("unused", "Lints that detect things being declared but not used, or excess syntax"),
diff --git a/src/tools/lint-docs/src/lib.rs b/src/tools/lint-docs/src/lib.rs
index 48e2dd09876..e0aef13ca79 100644
--- a/src/tools/lint-docs/src/lib.rs
+++ b/src/tools/lint-docs/src/lib.rs
@@ -3,6 +3,7 @@ use std::fmt::Write;
 use std::fs;
 use std::path::{Path, PathBuf};
 use std::process::Command;
+
 use walkdir::WalkDir;
 
 mod groups;
diff --git a/src/tools/lld-wrapper/src/main.rs b/src/tools/lld-wrapper/src/main.rs
index 79e279a8614..2f756ae3022 100644
--- a/src/tools/lld-wrapper/src/main.rs
+++ b/src/tools/lld-wrapper/src/main.rs
@@ -11,7 +11,8 @@
 //! obtained from the wrapper's name as the first two arguments.
 //! On Windows it spawns a `..\rust-lld.exe` child process.
 
-use std::env::{self, consts::EXE_SUFFIX};
+use std::env::consts::EXE_SUFFIX;
+use std::env::{self};
 use std::fmt::Display;
 use std::path::{Path, PathBuf};
 use std::process;
diff --git a/src/tools/llvm-bitcode-linker/src/bin/llvm-bitcode-linker.rs b/src/tools/llvm-bitcode-linker/src/bin/llvm-bitcode-linker.rs
index a92af71a36e..fdbf6171c53 100644
--- a/src/tools/llvm-bitcode-linker/src/bin/llvm-bitcode-linker.rs
+++ b/src/tools/llvm-bitcode-linker/src/bin/llvm-bitcode-linker.rs
@@ -1,7 +1,6 @@
 use std::path::PathBuf;
 
 use clap::Parser;
-
 use llvm_bitcode_linker::{Optimization, Session, Target};
 
 #[derive(Debug, Parser)]
diff --git a/src/tools/llvm-bitcode-linker/src/linker.rs b/src/tools/llvm-bitcode-linker/src/linker.rs
index 40572f22342..9f579d10094 100644
--- a/src/tools/llvm-bitcode-linker/src/linker.rs
+++ b/src/tools/llvm-bitcode-linker/src/linker.rs
@@ -2,8 +2,7 @@ use std::path::PathBuf;
 
 use anyhow::Context;
 
-use crate::Optimization;
-use crate::Target;
+use crate::{Optimization, Target};
 
 #[derive(Debug)]
 pub struct Session {
diff --git a/src/tools/llvm-bitcode-linker/src/opt.rs b/src/tools/llvm-bitcode-linker/src/opt.rs
index 93f0ec7e2d6..12692c4cbb4 100644
--- a/src/tools/llvm-bitcode-linker/src/opt.rs
+++ b/src/tools/llvm-bitcode-linker/src/opt.rs
@@ -1,5 +1,4 @@
-use std::fmt::Display;
-use std::fmt::Formatter;
+use std::fmt::{Display, Formatter};
 
 #[derive(Debug, Clone, Copy, Default, Hash, Eq, PartialEq, clap::ValueEnum)]
 pub enum Optimization {
diff --git a/src/tools/opt-dist/src/bolt.rs b/src/tools/opt-dist/src/bolt.rs
index eb10426f060..d9efbb8d880 100644
--- a/src/tools/opt-dist/src/bolt.rs
+++ b/src/tools/opt-dist/src/bolt.rs
@@ -1,9 +1,8 @@
 use anyhow::Context;
+use camino::{Utf8Path, Utf8PathBuf};
 
 use crate::exec::cmd;
 use crate::training::BoltProfile;
-use camino::{Utf8Path, Utf8PathBuf};
-
 use crate::utils::io::copy_file;
 
 /// Instruments an artifact at the given `path` (in-place) with BOLT and then calls `func`.
diff --git a/src/tools/opt-dist/src/exec.rs b/src/tools/opt-dist/src/exec.rs
index 90a045e83d7..e50f2600e85 100644
--- a/src/tools/opt-dist/src/exec.rs
+++ b/src/tools/opt-dist/src/exec.rs
@@ -1,11 +1,13 @@
+use std::collections::BTreeMap;
+use std::fs::File;
+use std::process::{Command, Stdio};
+
+use camino::{Utf8Path, Utf8PathBuf};
+
 use crate::environment::Environment;
 use crate::metrics::{load_metrics, record_metrics};
 use crate::timer::TimerSection;
 use crate::training::{BoltProfile, LlvmPGOProfile, RustcPGOProfile};
-use camino::{Utf8Path, Utf8PathBuf};
-use std::collections::BTreeMap;
-use std::fs::File;
-use std::process::{Command, Stdio};
 
 #[derive(Default)]
 pub struct CmdBuilder {
diff --git a/src/tools/opt-dist/src/main.rs b/src/tools/opt-dist/src/main.rs
index e4271a6e2dd..73389f930bd 100644
--- a/src/tools/opt-dist/src/main.rs
+++ b/src/tools/opt-dist/src/main.rs
@@ -1,10 +1,10 @@
-use crate::bolt::{bolt_optimize, with_bolt_instrumented};
 use anyhow::Context;
 use camino::{Utf8Path, Utf8PathBuf};
 use clap::Parser;
 use log::LevelFilter;
 use utils::io;
 
+use crate::bolt::{bolt_optimize, with_bolt_instrumented};
 use crate::environment::{Environment, EnvironmentBuilder};
 use crate::exec::{cmd, Bootstrap};
 use crate::tests::run_tests;
diff --git a/src/tools/opt-dist/src/metrics.rs b/src/tools/opt-dist/src/metrics.rs
index cabe07eda32..89c4cb12d4c 100644
--- a/src/tools/opt-dist/src/metrics.rs
+++ b/src/tools/opt-dist/src/metrics.rs
@@ -1,7 +1,9 @@
-use crate::timer::TimerSection;
+use std::time::Duration;
+
 use build_helper::metrics::{JsonNode, JsonRoot};
 use camino::Utf8Path;
-use std::time::Duration;
+
+use crate::timer::TimerSection;
 
 #[derive(Clone, Debug)]
 pub struct BuildStep {
diff --git a/src/tools/opt-dist/src/tests.rs b/src/tools/opt-dist/src/tests.rs
index d03d1936e08..f6bf3b99ab2 100644
--- a/src/tools/opt-dist/src/tests.rs
+++ b/src/tools/opt-dist/src/tests.rs
@@ -1,8 +1,9 @@
+use anyhow::Context;
+use camino::{Utf8Path, Utf8PathBuf};
+
 use crate::environment::{executable_extension, Environment};
 use crate::exec::cmd;
 use crate::utils::io::{copy_directory, find_file_in_dir, unpack_archive};
-use anyhow::Context;
-use camino::{Utf8Path, Utf8PathBuf};
 
 /// Run tests on optimized dist artifacts.
 pub fn run_tests(env: &Environment) -> anyhow::Result<()> {
diff --git a/src/tools/opt-dist/src/training.rs b/src/tools/opt-dist/src/training.rs
index 1237951b3f0..97e8ec5c6ed 100644
--- a/src/tools/opt-dist/src/training.rs
+++ b/src/tools/opt-dist/src/training.rs
@@ -1,12 +1,13 @@
-use crate::environment::{executable_extension, Environment};
-use crate::exec::{cmd, CmdBuilder};
-use crate::utils::io::{count_files, delete_directory};
-use crate::utils::with_log_group;
 use anyhow::Context;
 use build_helper::{LLVM_PGO_CRATES, RUSTC_PGO_CRATES};
 use camino::{Utf8Path, Utf8PathBuf};
 use humansize::BINARY;
 
+use crate::environment::{executable_extension, Environment};
+use crate::exec::{cmd, CmdBuilder};
+use crate::utils::io::{count_files, delete_directory};
+use crate::utils::with_log_group;
+
 fn init_compiler_benchmarks(
     env: &Environment,
     profiles: &[&str],
diff --git a/src/tools/opt-dist/src/utils/artifact_size.rs b/src/tools/opt-dist/src/utils/artifact_size.rs
index b6c453fb40b..e51b5f06dfb 100644
--- a/src/tools/opt-dist/src/utils/artifact_size.rs
+++ b/src/tools/opt-dist/src/utils/artifact_size.rs
@@ -9,10 +9,10 @@ use crate::environment::Environment;
 use crate::utils::io::get_files_from_dir;
 
 pub fn print_binary_sizes(env: &Environment) -> anyhow::Result<()> {
-    use humansize::format_size;
-    use humansize::BINARY;
     use std::fmt::Write;
 
+    use humansize::{format_size, BINARY};
+
     let root = env.build_artifacts().join("stage2");
 
     let mut files = get_files_from_dir(&root.join("bin"), None)?;
diff --git a/src/tools/opt-dist/src/utils/io.rs b/src/tools/opt-dist/src/utils/io.rs
index d6bd5cb85e4..ce425bdfece 100644
--- a/src/tools/opt-dist/src/utils/io.rs
+++ b/src/tools/opt-dist/src/utils/io.rs
@@ -1,8 +1,9 @@
+use std::fs::File;
+use std::path::Path;
+
 use anyhow::Context;
 use camino::{Utf8Path, Utf8PathBuf};
 use fs_extra::dir::CopyOptions;
-use std::fs::File;
-use std::path::Path;
 
 /// Delete and re-create the directory.
 pub fn reset_directory(path: &Utf8Path) -> anyhow::Result<()> {
diff --git a/src/tools/opt-dist/src/utils/mod.rs b/src/tools/opt-dist/src/utils/mod.rs
index 22b0483c071..32d88a59af9 100644
--- a/src/tools/opt-dist/src/utils/mod.rs
+++ b/src/tools/opt-dist/src/utils/mod.rs
@@ -1,10 +1,11 @@
+use std::time::Duration;
+
+use humansize::BINARY;
 use sysinfo::Disks;
 
 use crate::environment::Environment;
 use crate::timer::Timer;
 use crate::utils::io::delete_directory;
-use humansize::BINARY;
-use std::time::Duration;
 
 pub mod artifact_size;
 pub mod io;
diff --git a/src/tools/remote-test-client/src/main.rs b/src/tools/remote-test-client/src/main.rs
index 42de3caf547..bda08423487 100644
--- a/src/tools/remote-test-client/src/main.rs
+++ b/src/tools/remote-test-client/src/main.rs
@@ -5,15 +5,14 @@
 //! Here is also where we bake in the support to spawn the QEMU emulator as
 //! well.
 
-use std::env;
 use std::fs::{self, File};
 use std::io::prelude::*;
 use std::io::{self, BufWriter};
 use std::net::TcpStream;
 use std::path::{Path, PathBuf};
 use std::process::{Command, Stdio};
-use std::thread;
 use std::time::Duration;
+use std::{env, thread};
 
 const REMOTE_ADDR_ENV: &str = "TEST_DEVICE_ADDR";
 const DEFAULT_ADDR: &str = "127.0.0.1:12345";
diff --git a/src/tools/remote-test-server/src/main.rs b/src/tools/remote-test-server/src/main.rs
index 79f96c50223..67a7ad6f3b4 100644
--- a/src/tools/remote-test-server/src/main.rs
+++ b/src/tools/remote-test-server/src/main.rs
@@ -12,22 +12,17 @@
 
 #[cfg(not(windows))]
 use std::fs::Permissions;
-use std::net::SocketAddr;
-#[cfg(not(windows))]
-use std::os::unix::prelude::*;
-
-use std::cmp;
-use std::env;
 use std::fs::{self, File};
 use std::io::prelude::*;
 use std::io::{self, BufReader};
-use std::net::{TcpListener, TcpStream};
+use std::net::{SocketAddr, TcpListener, TcpStream};
+#[cfg(not(windows))]
+use std::os::unix::prelude::*;
 use std::path::{Path, PathBuf};
 use std::process::{Command, ExitStatus, Stdio};
-use std::str;
 use std::sync::atomic::{AtomicUsize, Ordering};
 use std::sync::{Arc, Mutex};
-use std::thread;
+use std::{cmp, env, str, thread};
 
 macro_rules! t {
     ($e:expr) => {
diff --git a/src/tools/replace-version-placeholder/src/main.rs b/src/tools/replace-version-placeholder/src/main.rs
index 5c9c18b9b36..247e4e7e932 100644
--- a/src/tools/replace-version-placeholder/src/main.rs
+++ b/src/tools/replace-version-placeholder/src/main.rs
@@ -1,4 +1,5 @@
 use std::path::PathBuf;
+
 use tidy::{t, walk};
 
 pub const VERSION_PLACEHOLDER: &str = "CURRENT_RUSTC_VERSION";
diff --git a/src/tools/rls/src/main.rs b/src/tools/rls/src/main.rs
index d7be108e89c..3a95b47cd4d 100644
--- a/src/tools/rls/src/main.rs
+++ b/src/tools/rls/src/main.rs
@@ -3,10 +3,10 @@
 //! This is a small stub that replaces RLS to alert the user that RLS is no
 //! longer available.
 
-use serde_json::Value;
 use std::error::Error;
-use std::io::BufRead;
-use std::io::Write;
+use std::io::{BufRead, Write};
+
+use serde_json::Value;
 
 const ALERT_MSG: &str = "\
 RLS is no longer available as of Rust 1.65.
diff --git a/src/tools/run-make-support/src/command.rs b/src/tools/run-make-support/src/command.rs
index 47376c401bb..fb94ff996f0 100644
--- a/src/tools/run-make-support/src/command.rs
+++ b/src/tools/run-make-support/src/command.rs
@@ -1,15 +1,14 @@
-use std::ffi;
 use std::ffi::OsStr;
 use std::io::Write;
-use std::panic;
 use std::path::Path;
 use std::process::{Command as StdCommand, ExitStatus, Output, Stdio};
+use std::{ffi, panic};
+
+use build_helper::drop_bomb::DropBomb;
 
 use crate::util::handle_failed_output;
 use crate::{assert_contains, assert_equals, assert_not_contains};
 
-use build_helper::drop_bomb::DropBomb;
-
 /// This is a custom command wrapper that simplifies working with commands and makes it easier to
 /// ensure that we check the exit status of executed processes.
 ///
diff --git a/src/tools/run-make-support/src/diff/mod.rs b/src/tools/run-make-support/src/diff/mod.rs
index ac662331606..b0ed4d5445c 100644
--- a/src/tools/run-make-support/src/diff/mod.rs
+++ b/src/tools/run-make-support/src/diff/mod.rs
@@ -1,10 +1,9 @@
 use std::path::{Path, PathBuf};
 
+use build_helper::drop_bomb::DropBomb;
 use regex::Regex;
 use similar::TextDiff;
 
-use build_helper::drop_bomb::DropBomb;
-
 use crate::fs;
 
 #[cfg(test)]
diff --git a/src/tools/run-make-support/src/external_deps/cc.rs b/src/tools/run-make-support/src/external_deps/cc.rs
index 19a89705acc..39ac3efef39 100644
--- a/src/tools/run-make-support/src/external_deps/cc.rs
+++ b/src/tools/run-make-support/src/external_deps/cc.rs
@@ -1,10 +1,9 @@
 use std::path::Path;
 
-use crate::command::Command;
-use crate::{env_var, is_msvc, is_windows, uname};
-
 // FIXME(jieyouxu): can we get rid of the `cygpath` external dependency?
 use super::cygpath::get_windows_path;
+use crate::command::Command;
+use crate::{env_var, is_msvc, is_windows, uname};
 
 /// Construct a new platform-specific C compiler invocation.
 ///
diff --git a/src/tools/run-make-support/src/external_deps/htmldocck.rs b/src/tools/run-make-support/src/external_deps/htmldocck.rs
index afd0711ee04..621d386d85f 100644
--- a/src/tools/run-make-support/src/external_deps/htmldocck.rs
+++ b/src/tools/run-make-support/src/external_deps/htmldocck.rs
@@ -1,8 +1,7 @@
+use super::python::python_command;
 use crate::command::Command;
 use crate::source_root;
 
-use super::python::python_command;
-
 /// `htmldocck` is a python script which is used for rustdoc test suites, it is assumed to be
 /// available at `$SOURCE_ROOT/src/etc/htmldocck.py`.
 #[track_caller]
diff --git a/src/tools/run-make-support/src/run.rs b/src/tools/run-make-support/src/run.rs
index 17f8ce34f19..12088e5d3b5 100644
--- a/src/tools/run-make-support/src/run.rs
+++ b/src/tools/run-make-support/src/run.rs
@@ -1,7 +1,6 @@
-use std::env;
 use std::ffi::OsStr;
-use std::panic;
 use std::path::{Path, PathBuf};
+use std::{env, panic};
 
 use crate::command::{Command, CompletedProcess};
 use crate::util::{handle_failed_output, set_host_rpath};
diff --git a/src/tools/rust-installer/src/combiner.rs b/src/tools/rust-installer/src/combiner.rs
index e7020980dc3..66b3d324568 100644
--- a/src/tools/rust-installer/src/combiner.rs
+++ b/src/tools/rust-installer/src/combiner.rs
@@ -1,14 +1,13 @@
-use super::Scripter;
-use super::Tarballer;
-use crate::{
-    compression::{CompressionFormat, CompressionFormats, CompressionProfile},
-    util::*,
-};
-use anyhow::{bail, Context, Result};
 use std::io::{Read, Write};
 use std::path::Path;
+
+use anyhow::{bail, Context, Result};
 use tar::Archive;
 
+use super::{Scripter, Tarballer};
+use crate::compression::{CompressionFormat, CompressionFormats, CompressionProfile};
+use crate::util::*;
+
 actor! {
     #[derive(Debug)]
     pub struct Combiner {
diff --git a/src/tools/rust-installer/src/compression.rs b/src/tools/rust-installer/src/compression.rs
index 40c7c597e9b..df3a98ae789 100644
--- a/src/tools/rust-installer/src/compression.rs
+++ b/src/tools/rust-installer/src/compression.rs
@@ -1,8 +1,14 @@
+use std::fmt;
+use std::io::{Read, Write};
+use std::path::Path;
+use std::str::FromStr;
+
 use anyhow::{Context, Error};
-use flate2::{read::GzDecoder, write::GzEncoder};
+use flate2::read::GzDecoder;
+use flate2::write::GzEncoder;
 use rayon::prelude::*;
-use std::{fmt, io::Read, io::Write, path::Path, str::FromStr};
-use xz2::{read::XzDecoder, write::XzEncoder};
+use xz2::read::XzDecoder;
+use xz2::write::XzEncoder;
 
 #[derive(Default, Debug, Copy, Clone)]
 pub enum CompressionProfile {
diff --git a/src/tools/rust-installer/src/generator.rs b/src/tools/rust-installer/src/generator.rs
index 035a394deeb..e1228693344 100644
--- a/src/tools/rust-installer/src/generator.rs
+++ b/src/tools/rust-installer/src/generator.rs
@@ -1,12 +1,13 @@
-use super::Scripter;
-use super::Tarballer;
-use crate::compression::{CompressionFormats, CompressionProfile};
-use crate::util::*;
-use anyhow::{bail, format_err, Context, Result};
 use std::collections::BTreeSet;
 use std::io::Write;
 use std::path::Path;
 
+use anyhow::{bail, format_err, Context, Result};
+
+use super::{Scripter, Tarballer};
+use crate::compression::{CompressionFormats, CompressionProfile};
+use crate::util::*;
+
 actor! {
     #[derive(Debug)]
     pub struct Generator {
diff --git a/src/tools/rust-installer/src/scripter.rs b/src/tools/rust-installer/src/scripter.rs
index ff65e818b09..abac405050c 100644
--- a/src/tools/rust-installer/src/scripter.rs
+++ b/src/tools/rust-installer/src/scripter.rs
@@ -1,7 +1,9 @@
-use crate::util::*;
-use anyhow::{Context, Result};
 use std::io::Write;
 
+use anyhow::{Context, Result};
+
+use crate::util::*;
+
 const TEMPLATE: &str = include_str!("../install-template.sh");
 
 actor! {
diff --git a/src/tools/rust-installer/src/tarballer.rs b/src/tools/rust-installer/src/tarballer.rs
index b5e87a66ffc..a101be8f5ff 100644
--- a/src/tools/rust-installer/src/tarballer.rs
+++ b/src/tools/rust-installer/src/tarballer.rs
@@ -1,14 +1,13 @@
-use anyhow::{bail, Context, Result};
 use std::fs::{read_link, symlink_metadata};
 use std::io::{BufWriter, Write};
 use std::path::Path;
+
+use anyhow::{bail, Context, Result};
 use tar::{Builder, Header, HeaderMode};
 use walkdir::WalkDir;
 
-use crate::{
-    compression::{CombinedEncoder, CompressionFormats, CompressionProfile},
-    util::*,
-};
+use crate::compression::{CombinedEncoder, CompressionFormats, CompressionProfile};
+use crate::util::*;
 
 actor! {
     #[derive(Debug)]
diff --git a/src/tools/rust-installer/src/util.rs b/src/tools/rust-installer/src/util.rs
index 47ca0cfa3cc..51b8c9c9d1b 100644
--- a/src/tools/rust-installer/src/util.rs
+++ b/src/tools/rust-installer/src/util.rs
@@ -1,17 +1,16 @@
-use anyhow::{format_err, Context, Result};
 use std::fs;
-use std::path::Path;
-use walkdir::WalkDir;
-
-// Needed to set the script mode to executable.
-#[cfg(unix)]
-use std::os::unix::fs::OpenOptionsExt;
 // FIXME: what about Windows? Are default ACLs executable?
-
 #[cfg(unix)]
 use std::os::unix::fs::symlink as symlink_file;
+// Needed to set the script mode to executable.
+#[cfg(unix)]
+use std::os::unix::fs::OpenOptionsExt;
 #[cfg(windows)]
 use std::os::windows::fs::symlink_file;
+use std::path::Path;
+
+use anyhow::{format_err, Context, Result};
+use walkdir::WalkDir;
 
 /// Converts a `&Path` to a UTF-8 `&str`.
 pub fn path_to_str(path: &Path) -> Result<&str> {
diff --git a/src/tools/rustbook/src/main.rs b/src/tools/rustbook/src/main.rs
index e94c2f5958e..a4faac0760f 100644
--- a/src/tools/rustbook/src/main.rs
+++ b/src/tools/rustbook/src/main.rs
@@ -1,14 +1,10 @@
-use clap::crate_version;
-
 use std::env;
 use std::path::{Path, PathBuf};
 
-use clap::{arg, ArgMatches, Command};
-
+use clap::{arg, crate_version, ArgMatches, Command};
 use mdbook::errors::Result as Result3;
 use mdbook::MDBook;
 use mdbook_i18n_helpers::preprocessors::Gettext;
-
 use mdbook_spec::Spec;
 use mdbook_trpl_listing::TrplListing;
 use mdbook_trpl_note::TrplNote;
diff --git a/src/tools/rustc-perf-wrapper/src/main.rs b/src/tools/rustc-perf-wrapper/src/main.rs
index 1c0d1745f3d..991f4ea15ed 100644
--- a/src/tools/rustc-perf-wrapper/src/main.rs
+++ b/src/tools/rustc-perf-wrapper/src/main.rs
@@ -1,8 +1,10 @@
-use crate::config::{Profile, Scenario};
-use clap::Parser;
 use std::path::PathBuf;
 use std::process::Command;
 
+use clap::Parser;
+
+use crate::config::{Profile, Scenario};
+
 mod config;
 
 /// Performs profiling or benchmarking with [`rustc-perf`](https://github.com/rust-lang/rustc-perf)
diff --git a/src/tools/rustdoc-gui-test/src/config.rs b/src/tools/rustdoc-gui-test/src/config.rs
index dc4c56a5e7a..950e2fa478d 100644
--- a/src/tools/rustdoc-gui-test/src/config.rs
+++ b/src/tools/rustdoc-gui-test/src/config.rs
@@ -1,5 +1,7 @@
+use std::env;
+use std::path::PathBuf;
+
 use getopts::Options;
-use std::{env, path::PathBuf};
 
 pub(crate) struct Config {
     pub(crate) nodejs: PathBuf,
diff --git a/src/tools/rustdoc-gui-test/src/main.rs b/src/tools/rustdoc-gui-test/src/main.rs
index bf581279f2a..5adb525d7e6 100644
--- a/src/tools/rustdoc-gui-test/src/main.rs
+++ b/src/tools/rustdoc-gui-test/src/main.rs
@@ -1,11 +1,12 @@
-use build_helper::util::try_run;
-use compiletest::header::TestProps;
-use config::Config;
 use std::path::{Path, PathBuf};
 use std::process::Command;
 use std::sync::Arc;
 use std::{env, fs};
 
+use build_helper::util::try_run;
+use compiletest::header::TestProps;
+use config::Config;
+
 mod config;
 
 fn get_browser_ui_test_version_inner(npm: &Path, global: bool) -> Option<String> {
diff --git a/src/tools/suggest-tests/src/lib.rs b/src/tools/suggest-tests/src/lib.rs
index 8932403ac9f..cc1288c6b72 100644
--- a/src/tools/suggest-tests/src/lib.rs
+++ b/src/tools/suggest-tests/src/lib.rs
@@ -1,7 +1,5 @@
-use std::{
-    fmt::{self, Display},
-    path::Path,
-};
+use std::fmt::{self, Display};
+use std::path::Path;
 
 use dynamic_suggestions::DYNAMIC_SUGGESTIONS;
 use glob::Pattern;
diff --git a/src/tools/suggest-tests/src/static_suggestions.rs b/src/tools/suggest-tests/src/static_suggestions.rs
index a34a4b16ec1..a282facd9df 100644
--- a/src/tools/suggest-tests/src/static_suggestions.rs
+++ b/src/tools/suggest-tests/src/static_suggestions.rs
@@ -1,6 +1,7 @@
-use crate::{sug, Suggestion};
 use std::sync::OnceLock;
 
+use crate::{sug, Suggestion};
+
 // FIXME: perhaps this could use `std::lazy` when it is stablizied
 macro_rules! static_suggestions {
     ($( [ $( $glob:expr ),* $(,)? ] => [ $( $suggestion:expr ),* $(,)? ] ),* $(,)? ) => {
diff --git a/src/tools/tidy/src/alphabetical/tests.rs b/src/tools/tidy/src/alphabetical/tests.rs
index 560e0284b89..29e89a693bf 100644
--- a/src/tools/tidy/src/alphabetical/tests.rs
+++ b/src/tools/tidy/src/alphabetical/tests.rs
@@ -1,7 +1,8 @@
-use super::*;
 use std::io::Write;
 use std::str::from_utf8;
 
+use super::*;
+
 fn test(lines: &str, name: &str, expected_msg: &str, expected_bad: bool) {
     let mut actual_msg = Vec::new();
     let mut actual_bad = false;
diff --git a/src/tools/tidy/src/bins.rs b/src/tools/tidy/src/bins.rs
index c82e8b6fee9..d158a8e6324 100644
--- a/src/tools/tidy/src/bins.rs
+++ b/src/tools/tidy/src/bins.rs
@@ -21,12 +21,13 @@ mod os_impl {
 
 #[cfg(unix)]
 mod os_impl {
-    use crate::walk::{filter_dirs, walk_no_read};
     use std::fs;
     use std::os::unix::prelude::*;
     use std::path::Path;
     use std::process::{Command, Stdio};
 
+    use crate::walk::{filter_dirs, walk_no_read};
+
     enum FilesystemSupport {
         Supported,
         Unsupported,
diff --git a/src/tools/tidy/src/debug_artifacts.rs b/src/tools/tidy/src/debug_artifacts.rs
index 582014d5059..645534cc827 100644
--- a/src/tools/tidy/src/debug_artifacts.rs
+++ b/src/tools/tidy/src/debug_artifacts.rs
@@ -1,8 +1,9 @@
 //! Tidy check to prevent creation of unnecessary debug artifacts while running tests.
 
-use crate::walk::{filter_dirs, filter_not_rust, walk};
 use std::path::Path;
 
+use crate::walk::{filter_dirs, filter_not_rust, walk};
+
 const GRAPHVIZ_POSTFLOW_MSG: &str = "`borrowck_graphviz_postflow` attribute in test";
 
 pub fn check(test_dir: &Path, bad: &mut bool) {
diff --git a/src/tools/tidy/src/deps.rs b/src/tools/tidy/src/deps.rs
index 6898c4755d8..de59d7d89f9 100644
--- a/src/tools/tidy/src/deps.rs
+++ b/src/tools/tidy/src/deps.rs
@@ -1,11 +1,12 @@
 //! Checks the licenses of third-party dependencies.
 
-use build_helper::ci::CiEnv;
-use cargo_metadata::{Metadata, Package, PackageId};
 use std::collections::HashSet;
 use std::fs::read_dir;
 use std::path::Path;
 
+use build_helper::ci::CiEnv;
+use cargo_metadata::{Metadata, Package, PackageId};
+
 /// These are licenses that are allowed for all crates, including the runtime,
 /// rustc, tools, etc.
 #[rustfmt::skip]
diff --git a/src/tools/tidy/src/edition.rs b/src/tools/tidy/src/edition.rs
index f28f677e0ff..d658fe13d36 100644
--- a/src/tools/tidy/src/edition.rs
+++ b/src/tools/tidy/src/edition.rs
@@ -1,8 +1,9 @@
 //! Tidy check to ensure that crate `edition` is '2018' or '2021'.
 
-use crate::walk::{filter_dirs, walk};
 use std::path::Path;
 
+use crate::walk::{filter_dirs, walk};
+
 fn is_edition_2021(mut line: &str) -> bool {
     line = line.trim();
     line == "edition = \"2021\""
diff --git a/src/tools/tidy/src/error_codes.rs b/src/tools/tidy/src/error_codes.rs
index 47e2be761e6..8ddacc07c6f 100644
--- a/src/tools/tidy/src/error_codes.rs
+++ b/src/tools/tidy/src/error_codes.rs
@@ -16,7 +16,9 @@
 //! 4. We check that the error code is actually emitted by the compiler.
 //!   - This is done by searching `compiler/` with a regex.
 
-use std::{ffi::OsStr, fs, path::Path};
+use std::ffi::OsStr;
+use std::fs;
+use std::path::Path;
 
 use regex::Regex;
 
diff --git a/src/tools/tidy/src/ext_tool_checks.rs b/src/tools/tidy/src/ext_tool_checks.rs
index 8ce44115ef3..ea9ab01aaf8 100644
--- a/src/tools/tidy/src/ext_tool_checks.rs
+++ b/src/tools/tidy/src/ext_tool_checks.rs
@@ -18,11 +18,9 @@
 //!    is set, rerun the tool to print a suggestion diff (for e.g. CI)
 
 use std::ffi::OsStr;
-use std::fmt;
-use std::fs;
-use std::io;
 use std::path::{Path, PathBuf};
 use std::process::Command;
+use std::{fmt, fs, io};
 
 const MIN_PY_REV: (u32, u32) = (3, 9);
 const MIN_PY_REV_STR: &str = "≥3.9";
diff --git a/src/tools/tidy/src/features.rs b/src/tools/tidy/src/features.rs
index e8dff2dc261..a4d27d29d32 100644
--- a/src/tools/tidy/src/features.rs
+++ b/src/tools/tidy/src/features.rs
@@ -9,13 +9,13 @@
 //! * All unstable lang features have tests to ensure they are actually unstable.
 //! * Language features in a group are sorted by feature name.
 
-use crate::walk::{filter_dirs, filter_not_rust, walk, walk_many};
 use std::collections::hash_map::{Entry, HashMap};
 use std::ffi::OsStr;
-use std::fmt;
-use std::fs;
 use std::num::NonZeroU32;
 use std::path::{Path, PathBuf};
+use std::{fmt, fs};
+
+use crate::walk::{filter_dirs, filter_not_rust, walk, walk_many};
 
 #[cfg(test)]
 mod tests;
diff --git a/src/tools/tidy/src/fluent_alphabetical.rs b/src/tools/tidy/src/fluent_alphabetical.rs
index a85367984de..6f154b92eff 100644
--- a/src/tools/tidy/src/fluent_alphabetical.rs
+++ b/src/tools/tidy/src/fluent_alphabetical.rs
@@ -1,11 +1,14 @@
 //! Checks that all Flunt files have messages in alphabetical order
 
-use crate::walk::{filter_dirs, walk};
 use std::collections::HashMap;
-use std::{fs::OpenOptions, io::Write, path::Path};
+use std::fs::OpenOptions;
+use std::io::Write;
+use std::path::Path;
 
 use regex::Regex;
 
+use crate::walk::{filter_dirs, walk};
+
 fn message() -> &'static Regex {
     static_regex!(r#"(?m)^([a-zA-Z0-9_]+)\s*=\s*"#)
 }
diff --git a/src/tools/tidy/src/fluent_period.rs b/src/tools/tidy/src/fluent_period.rs
index 3a1fb6daf48..8bc404dc858 100644
--- a/src/tools/tidy/src/fluent_period.rs
+++ b/src/tools/tidy/src/fluent_period.rs
@@ -1,9 +1,10 @@
 //! Checks that no Fluent messages or attributes end in periods (except ellipses)
 
+use std::path::Path;
+
 use fluent_syntax::ast::{Entry, PatternElement};
 
 use crate::walk::{filter_dirs, walk};
-use std::path::Path;
 
 fn filter_fluent(path: &Path) -> bool {
     if let Some(ext) = path.extension() { ext.to_str() != Some("ftl") } else { true }
diff --git a/src/tools/tidy/src/fluent_used.rs b/src/tools/tidy/src/fluent_used.rs
index 8b6c6c18813..ab56b5f0b0e 100644
--- a/src/tools/tidy/src/fluent_used.rs
+++ b/src/tools/tidy/src/fluent_used.rs
@@ -1,9 +1,10 @@
 //! Checks that all Fluent messages appear at least twice
 
-use crate::walk::{filter_dirs, walk};
 use std::collections::HashMap;
 use std::path::Path;
 
+use crate::walk::{filter_dirs, walk};
+
 fn filter_used_messages(
     contents: &str,
     msgs_not_appeared_yet: &mut HashMap<String, String>,
diff --git a/src/tools/tidy/src/known_bug.rs b/src/tools/tidy/src/known_bug.rs
index a62556f762b..182a81c6ec9 100644
--- a/src/tools/tidy/src/known_bug.rs
+++ b/src/tools/tidy/src/known_bug.rs
@@ -1,8 +1,9 @@
 //! Tidy check to ensure that tests inside 'tests/crashes' have a '@known-bug' directive.
 
-use crate::walk::*;
 use std::path::Path;
 
+use crate::walk::*;
+
 pub fn check(filepath: &Path, bad: &mut bool) {
     walk(filepath, |path, _is_dir| filter_not_rust(path), &mut |entry, contents| {
         let file = entry.path();
diff --git a/src/tools/tidy/src/lib.rs b/src/tools/tidy/src/lib.rs
index ecd32727fa0..3215896091d 100644
--- a/src/tools/tidy/src/lib.rs
+++ b/src/tools/tidy/src/lib.rs
@@ -50,6 +50,7 @@ macro_rules! tidy_error_ext {
 
 fn tidy_error(args: &str) -> std::io::Result<()> {
     use std::io::Write;
+
     use termcolor::{Color, ColorChoice, ColorSpec, StandardStream};
 
     let mut stderr = StandardStream::stdout(ColorChoice::Auto);
diff --git a/src/tools/tidy/src/main.rs b/src/tools/tidy/src/main.rs
index ec6fc1f07f1..e6d21bfb245 100644
--- a/src/tools/tidy/src/main.rs
+++ b/src/tools/tidy/src/main.rs
@@ -4,16 +4,15 @@
 //! etc. This is run by default on `./x.py test` and as part of the auto
 //! builders. The tidy checks can be executed with `./x.py test tidy`.
 
-use tidy::*;
-
 use std::collections::VecDeque;
-use std::env;
 use std::num::NonZeroUsize;
 use std::path::PathBuf;
-use std::process;
 use std::str::FromStr;
 use std::sync::atomic::{AtomicBool, Ordering};
 use std::thread::{self, scope, ScopedJoinHandle};
+use std::{env, process};
+
+use tidy::*;
 
 fn main() {
     // Running Cargo will read the libstd Cargo.toml
diff --git a/src/tools/tidy/src/mir_opt_tests.rs b/src/tools/tidy/src/mir_opt_tests.rs
index 76feeb34331..bb0d8150be4 100644
--- a/src/tools/tidy/src/mir_opt_tests.rs
+++ b/src/tools/tidy/src/mir_opt_tests.rs
@@ -1,9 +1,10 @@
 //! Tidy check to ensure that mir opt directories do not have stale files or dashes in file names
 
-use miropt_test_tools::PanicStrategy;
 use std::collections::HashSet;
 use std::path::{Path, PathBuf};
 
+use miropt_test_tools::PanicStrategy;
+
 use crate::walk::walk_no_read;
 
 fn check_unused_files(path: &Path, bless: bool, bad: &mut bool) {
diff --git a/src/tools/tidy/src/pal.rs b/src/tools/tidy/src/pal.rs
index 2f8abc77566..b7ddf47186d 100644
--- a/src/tools/tidy/src/pal.rs
+++ b/src/tools/tidy/src/pal.rs
@@ -30,9 +30,10 @@
 //! platform-specific cfgs are allowed. Not sure yet how to deal with
 //! this in the long term.
 
-use crate::walk::{filter_dirs, walk};
 use std::path::Path;
 
+use crate::walk::{filter_dirs, walk};
+
 // Paths that may contain platform-specific code.
 const EXCEPTION_PATHS: &[&str] = &[
     "library/panic_abort",
diff --git a/src/tools/tidy/src/style.rs b/src/tools/tidy/src/style.rs
index 8d8cc7ad6d3..6394a1463b0 100644
--- a/src/tools/tidy/src/style.rs
+++ b/src/tools/tidy/src/style.rs
@@ -17,10 +17,14 @@
 //! `// ignore-tidy-CHECK-NAME`.
 // ignore-tidy-dbg
 
-use crate::walk::{filter_dirs, walk};
+use std::ffi::OsStr;
+use std::path::Path;
+use std::sync::LazyLock;
+
 use regex::RegexSetBuilder;
 use rustc_hash::FxHashMap;
-use std::{ffi::OsStr, path::Path, sync::LazyLock};
+
+use crate::walk::{filter_dirs, walk};
 
 #[cfg(test)]
 mod tests;
diff --git a/src/tools/tidy/src/target_policy.rs b/src/tools/tidy/src/target_policy.rs
index cb9a0c1c7f4..776221d3062 100644
--- a/src/tools/tidy/src/target_policy.rs
+++ b/src/tools/tidy/src/target_policy.rs
@@ -2,8 +2,10 @@
 //!
 //! As of writing, only checks that sanity-check assembly test for targets doesn't miss any targets.
 
+use std::collections::HashSet;
+use std::path::Path;
+
 use crate::walk::{filter_not_rust, walk};
-use std::{collections::HashSet, path::Path};
 
 const TARGET_DEFINITIONS_PATH: &str = "compiler/rustc_target/src/spec/targets/";
 const ASSEMBLY_TEST_PATH: &str = "tests/assembly/targets/";
diff --git a/src/tools/tidy/src/ui_tests.rs b/src/tools/tidy/src/ui_tests.rs
index 0ae0356b2c4..41f7778c952 100644
--- a/src/tools/tidy/src/ui_tests.rs
+++ b/src/tools/tidy/src/ui_tests.rs
@@ -2,13 +2,14 @@
 //! - the number of entries in each directory must be less than `ENTRY_LIMIT`
 //! - there are no stray `.stderr` files
 
-use ignore::Walk;
 use std::collections::{BTreeSet, HashMap};
 use std::ffi::OsStr;
 use std::fs;
 use std::io::Write;
 use std::path::{Path, PathBuf};
 
+use ignore::Walk;
+
 // FIXME: GitHub's UI truncates file lists that exceed 1000 entries, so these
 // should all be 1000 or lower. Limits significantly smaller than 1000 are also
 // desirable, because large numbers of files are unwieldy in general. See issue
diff --git a/src/tools/tidy/src/unit_tests.rs b/src/tools/tidy/src/unit_tests.rs
index 0a5dad88789..708e4ef8085 100644
--- a/src/tools/tidy/src/unit_tests.rs
+++ b/src/tools/tidy/src/unit_tests.rs
@@ -7,9 +7,10 @@
 //! named `tests.rs` or `benches.rs`, or directories named `tests` or `benches` unconfigured
 //! during normal build.
 
-use crate::walk::{filter_dirs, walk};
 use std::path::Path;
 
+use crate::walk::{filter_dirs, walk};
+
 pub fn check(root_path: &Path, bad: &mut bool) {
     let core = root_path.join("core");
     let core_copy = core.clone();
diff --git a/src/tools/tidy/src/unstable_book.rs b/src/tools/tidy/src/unstable_book.rs
index 7dfb6224d24..8be25b98df0 100644
--- a/src/tools/tidy/src/unstable_book.rs
+++ b/src/tools/tidy/src/unstable_book.rs
@@ -1,8 +1,9 @@
-use crate::features::{CollectedFeatures, Features, Status};
 use std::collections::BTreeSet;
 use std::fs;
 use std::path::{Path, PathBuf};
 
+use crate::features::{CollectedFeatures, Features, Status};
+
 pub const PATH_STR: &str = "doc/unstable-book";
 
 pub const COMPILER_FLAGS_DIR: &str = "src/compiler-flags";
diff --git a/src/tools/tidy/src/walk.rs b/src/tools/tidy/src/walk.rs
index 1cecf998e28..d4721b5a5fd 100644
--- a/src/tools/tidy/src/walk.rs
+++ b/src/tools/tidy/src/walk.rs
@@ -1,6 +1,9 @@
-use ignore::DirEntry;
+use std::ffi::OsStr;
+use std::fs::File;
+use std::io::Read;
+use std::path::Path;
 
-use std::{ffi::OsStr, fs::File, io::Read, path::Path};
+use ignore::DirEntry;
 
 /// The default directory filter.
 pub fn filter_dirs(path: &Path) -> bool {
diff --git a/src/tools/tidy/src/x_version.rs b/src/tools/tidy/src/x_version.rs
index 55bfbed8b0e..489343561e1 100644
--- a/src/tools/tidy/src/x_version.rs
+++ b/src/tools/tidy/src/x_version.rs
@@ -1,7 +1,8 @@
-use semver::Version;
 use std::path::Path;
 use std::process::{Command, Stdio};
 
+use semver::Version;
+
 pub fn check(root: &Path, cargo: &Path, bad: &mut bool) {
     let cargo_list = Command::new(cargo).args(["install", "--list"]).stdout(Stdio::piped()).spawn();
 
diff --git a/src/tools/unicode-table-generator/src/cascading_map.rs b/src/tools/unicode-table-generator/src/cascading_map.rs
index 02c7542309a..036f0bd7eac 100644
--- a/src/tools/unicode-table-generator/src/cascading_map.rs
+++ b/src/tools/unicode-table-generator/src/cascading_map.rs
@@ -1,9 +1,10 @@
-use crate::fmt_list;
-use crate::raw_emitter::RawEmitter;
 use std::collections::HashMap;
 use std::fmt::Write as _;
 use std::ops::Range;
 
+use crate::fmt_list;
+use crate::raw_emitter::RawEmitter;
+
 impl RawEmitter {
     pub fn emit_cascading_map(&mut self, ranges: &[Range<u32>]) -> bool {
         let mut map: [u8; 256] = [
diff --git a/src/tools/unicode-table-generator/src/case_mapping.rs b/src/tools/unicode-table-generator/src/case_mapping.rs
index 7a978db62b4..f28161c7829 100644
--- a/src/tools/unicode-table-generator/src/case_mapping.rs
+++ b/src/tools/unicode-table-generator/src/case_mapping.rs
@@ -1,9 +1,8 @@
+use std::char;
+use std::collections::BTreeMap;
+use std::fmt::{self, Write};
+
 use crate::{fmt_list, UnicodeData};
-use std::{
-    char,
-    collections::BTreeMap,
-    fmt::{self, Write},
-};
 
 const INDEX_MASK: u32 = 1 << 22;
 
diff --git a/src/tools/unicode-table-generator/src/main.rs b/src/tools/unicode-table-generator/src/main.rs
index 2fe578acd90..9f89e7c33f7 100644
--- a/src/tools/unicode-table-generator/src/main.rs
+++ b/src/tools/unicode-table-generator/src/main.rs
@@ -73,6 +73,7 @@
 
 use std::collections::{BTreeMap, HashMap};
 use std::ops::Range;
+
 use ucd_parse::Codepoints;
 
 mod cascading_map;
diff --git a/src/tools/unicode-table-generator/src/raw_emitter.rs b/src/tools/unicode-table-generator/src/raw_emitter.rs
index ef5cea18ea2..47120e4f169 100644
--- a/src/tools/unicode-table-generator/src/raw_emitter.rs
+++ b/src/tools/unicode-table-generator/src/raw_emitter.rs
@@ -1,8 +1,9 @@
-use crate::fmt_list;
 use std::collections::{BTreeMap, BTreeSet, HashMap};
 use std::fmt::{self, Write};
 use std::ops::Range;
 
+use crate::fmt_list;
+
 #[derive(Clone)]
 pub struct RawEmitter {
     pub file: String,
diff --git a/src/tools/unicode-table-generator/src/skiplist.rs b/src/tools/unicode-table-generator/src/skiplist.rs
index 8fae8289e25..8ca18ddc91a 100644
--- a/src/tools/unicode-table-generator/src/skiplist.rs
+++ b/src/tools/unicode-table-generator/src/skiplist.rs
@@ -1,8 +1,9 @@
-use crate::fmt_list;
-use crate::raw_emitter::RawEmitter;
 use std::fmt::Write as _;
 use std::ops::Range;
 
+use crate::fmt_list;
+use crate::raw_emitter::RawEmitter;
+
 /// This will get packed into a single u32 before inserting into the data set.
 #[derive(Debug, PartialEq)]
 struct ShortOffsetRunHeader {
diff --git a/src/tools/unicode-table-generator/src/unicode_download.rs b/src/tools/unicode-table-generator/src/unicode_download.rs
index 714bb53382e..c9826170905 100644
--- a/src/tools/unicode-table-generator/src/unicode_download.rs
+++ b/src/tools/unicode-table-generator/src/unicode_download.rs
@@ -1,7 +1,8 @@
-use crate::UNICODE_DIRECTORY;
 use std::path::Path;
 use std::process::{Command, Output};
 
+use crate::UNICODE_DIRECTORY;
+
 static URL_PREFIX: &str = "https://www.unicode.org/Public/UCD/latest/ucd/";
 
 static README: &str = "ReadMe.txt";
diff --git a/src/tools/unstable-book-gen/src/main.rs b/src/tools/unstable-book-gen/src/main.rs
index a9830a3840d..9af8802b012 100644
--- a/src/tools/unstable-book-gen/src/main.rs
+++ b/src/tools/unstable-book-gen/src/main.rs
@@ -4,6 +4,7 @@ use std::collections::BTreeSet;
 use std::env;
 use std::fs::{self, write};
 use std::path::Path;
+
 use tidy::features::{collect_lang_features, collect_lib_features, Features};
 use tidy::t;
 use tidy::unstable_book::{
diff --git a/src/tools/x/src/main.rs b/src/tools/x/src/main.rs
index 5da8a2888ec..b288cfcd5be 100644
--- a/src/tools/x/src/main.rs
+++ b/src/tools/x/src/main.rs
@@ -8,12 +8,11 @@
 //! the ones that call `x.py`. We use `sh -c` on Unix, because it is a standard.
 //! We also don't use `pwsh` on Windows, because it is not installed by default;
 
-use std::{
-    env::{self, consts::EXE_EXTENSION},
-    io,
-    path::Path,
-    process::{self, Command, ExitStatus},
-};
+use std::env::consts::EXE_EXTENSION;
+use std::env::{self};
+use std::io;
+use std::path::Path;
+use std::process::{self, Command, ExitStatus};
 
 const PYTHON: &str = "python";
 const PYTHON2: &str = "python2";