From ea9f491696d9b39e9a6c4942ce7ef973ad36a271 Mon Sep 17 00:00:00 2001 From: Nicholas Nethercote Date: Mon, 29 Jul 2024 08:13:50 +1000 Subject: [PATCH] Reformat `use` declarations. The previous commit updated `rustfmt.toml` appropriately. This commit is the outcome of running `x fmt --all` with the new formatting options. --- build_system/abi_cafe.rs | 3 +-- build_system/build_sysroot.rs | 3 +-- build_system/config.rs | 3 +-- build_system/main.rs | 3 +-- build_system/tests.rs | 4 +--- build_system/utils.rs | 4 +--- example/alloc_system.rs | 5 +++-- example/arbitrary_self_types_pointers_and_wrappers.rs | 6 ++---- src/debuginfo/unwind.rs | 3 ++- src/driver/aot.rs | 8 +++++--- src/driver/jit.rs | 4 ++-- src/lib.rs | 5 ++--- src/main_shim.rs | 3 +-- src/optimize/peephole.rs | 3 ++- 14 files changed, 25 insertions(+), 32 deletions(-) diff --git a/build_system/abi_cafe.rs b/build_system/abi_cafe.rs index ecf303c30b6..75f9f233cb3 100644 --- a/build_system/abi_cafe.rs +++ b/build_system/abi_cafe.rs @@ -1,8 +1,7 @@ -use crate::build_sysroot; use crate::path::Dirs; use crate::prepare::GitRepo; use crate::utils::{spawn_and_wait, CargoProject, Compiler}; -use crate::{CodegenBackend, SysrootKind}; +use crate::{build_sysroot, CodegenBackend, SysrootKind}; static ABI_CAFE_REPO: GitRepo = GitRepo::github( "Gankra", diff --git a/build_system/build_sysroot.rs b/build_system/build_sysroot.rs index dfbe0f51e7b..5e9967aaeb1 100644 --- a/build_system/build_sysroot.rs +++ b/build_system/build_sysroot.rs @@ -1,7 +1,6 @@ -use std::env; -use std::fs; use std::path::{Path, PathBuf}; use std::process::Command; +use std::{env, fs}; use crate::path::{Dirs, RelPath}; use crate::rustc_info::get_file_name; diff --git a/build_system/config.rs b/build_system/config.rs index c31784e1097..ef540cf1f82 100644 --- a/build_system/config.rs +++ b/build_system/config.rs @@ -1,5 +1,4 @@ -use std::fs; -use std::process; +use std::{fs, process}; fn load_config_file() -> Vec<(String, Option)> { fs::read_to_string("config.txt") diff --git a/build_system/main.rs b/build_system/main.rs index 7dbf608f991..9ddeda583af 100644 --- a/build_system/main.rs +++ b/build_system/main.rs @@ -2,9 +2,8 @@ #![warn(unused_lifetimes)] #![warn(unreachable_pub)] -use std::env; use std::path::PathBuf; -use std::process; +use std::{env, process}; use self::utils::Compiler; diff --git a/build_system/tests.rs b/build_system/tests.rs index 790d9cbd9fc..afc8a923863 100644 --- a/build_system/tests.rs +++ b/build_system/tests.rs @@ -3,14 +3,12 @@ use std::path::PathBuf; use std::process::Command; -use crate::build_sysroot; -use crate::config; use crate::path::{Dirs, RelPath}; use crate::prepare::{apply_patches, GitRepo}; use crate::rustc_info::get_default_sysroot; use crate::shared_utils::rustflags_from_env; use crate::utils::{spawn_and_wait, CargoProject, Compiler, LogGroup}; -use crate::{CodegenBackend, SysrootKind}; +use crate::{build_sysroot, config, CodegenBackend, SysrootKind}; static BUILD_EXAMPLE_OUT_DIR: RelPath = RelPath::BUILD.join("example"); diff --git a/build_system/utils.rs b/build_system/utils.rs index 9f95122b341..3c4b45e02cc 100644 --- a/build_system/utils.rs +++ b/build_system/utils.rs @@ -1,9 +1,7 @@ -use std::env; -use std::fs; -use std::io; use std::path::{Path, PathBuf}; use std::process::{self, Command}; use std::sync::atomic::{AtomicBool, Ordering}; +use std::{env, fs, io}; use crate::path::{Dirs, RelPath}; use crate::shared_utils::rustflags_to_cmd_env; diff --git a/example/alloc_system.rs b/example/alloc_system.rs index 441f3cd2987..2884c9c32ae 100644 --- a/example/alloc_system.rs +++ b/example/alloc_system.rs @@ -8,8 +8,7 @@ #[cfg(any(windows, unix, target_os = "redox"))] mod realloc_fallback { use core::alloc::{GlobalAlloc, Layout}; - use core::cmp; - use core::ptr; + use core::{cmp, ptr}; impl super::System { pub(crate) unsafe fn realloc_fallback( &self, @@ -34,6 +33,7 @@ mod platform { use core::alloc::{GlobalAlloc, Layout}; use core::ffi::c_void; use core::ptr; + use System; extern "C" { fn posix_memalign(memptr: *mut *mut c_void, align: usize, size: usize) -> i32; @@ -71,6 +71,7 @@ unsafe fn aligned_malloc(layout: &Layout) -> *mut u8 { #[allow(nonstandard_style)] mod platform { use core::alloc::{GlobalAlloc, Layout}; + use System; type LPVOID = *mut u8; type HANDLE = LPVOID; diff --git a/example/arbitrary_self_types_pointers_and_wrappers.rs b/example/arbitrary_self_types_pointers_and_wrappers.rs index f7edfa960a2..5479b0c617b 100644 --- a/example/arbitrary_self_types_pointers_and_wrappers.rs +++ b/example/arbitrary_self_types_pointers_and_wrappers.rs @@ -2,10 +2,8 @@ #![feature(arbitrary_self_types, unsize, coerce_unsized, dispatch_from_dyn)] -use std::{ - marker::Unsize, - ops::{CoerceUnsized, Deref, DispatchFromDyn}, -}; +use std::marker::Unsize; +use std::ops::{CoerceUnsized, Deref, DispatchFromDyn}; struct Ptr(Box); diff --git a/src/debuginfo/unwind.rs b/src/debuginfo/unwind.rs index eebd181341d..ac7dd0bd463 100644 --- a/src/debuginfo/unwind.rs +++ b/src/debuginfo/unwind.rs @@ -1,7 +1,8 @@ //! Unwind info generation (`.eh_frame`) use cranelift_codegen::ir::Endianness; -use cranelift_codegen::isa::{unwind::UnwindInfo, TargetIsa}; +use cranelift_codegen::isa::unwind::UnwindInfo; +use cranelift_codegen::isa::TargetIsa; use cranelift_object::ObjectProduct; use gimli::write::{CieId, EhFrame, FrameTable, Section}; use gimli::RunTimeEndian; diff --git a/src/driver/aot.rs b/src/driver/aot.rs index 763d9a48407..b6fee1bf24a 100644 --- a/src/driver/aot.rs +++ b/src/driver/aot.rs @@ -11,8 +11,9 @@ use rustc_codegen_ssa::back::link::ensure_removed; use rustc_codegen_ssa::back::metadata::create_compressed_metadata_file; use rustc_codegen_ssa::base::determine_cgu_reuse; -use rustc_codegen_ssa::errors as ssa_errors; -use rustc_codegen_ssa::{CodegenResults, CompiledModule, CrateInfo, ModuleKind}; +use rustc_codegen_ssa::{ + errors as ssa_errors, CodegenResults, CompiledModule, CrateInfo, ModuleKind, +}; use rustc_data_structures::profiling::SelfProfilerRef; use rustc_data_structures::stable_hasher::{HashStable, StableHasher}; use rustc_data_structures::sync::{par_map, IntoDynSyncSend}; @@ -26,8 +27,9 @@ use crate::concurrency_limiter::{ConcurrencyLimiter, ConcurrencyLimiterToken}; use crate::debuginfo::TypeDebugContext; use crate::global_asm::GlobalAsmConfig; +use crate::prelude::*; use crate::unwind_module::UnwindModule; -use crate::{prelude::*, BackendConfig}; +use crate::BackendConfig; struct ModuleCodegenResult { module_regular: CompiledModule, diff --git a/src/driver/jit.rs b/src/driver/jit.rs index dfee8e714e6..12e860f676d 100644 --- a/src/driver/jit.rs +++ b/src/driver/jit.rs @@ -14,9 +14,9 @@ use rustc_span::Symbol; use crate::debuginfo::TypeDebugContext; +use crate::prelude::*; use crate::unwind_module::UnwindModule; -use crate::{prelude::*, BackendConfig}; -use crate::{CodegenCx, CodegenMode}; +use crate::{BackendConfig, CodegenCx, CodegenMode}; struct JitState { jit_module: UnwindModule, diff --git a/src/lib.rs b/src/lib.rs index 8d3d5ac98e1..9d46d8d6dac 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -85,10 +85,9 @@ mod prelude { pub(crate) use cranelift_codegen::ir::condcodes::{FloatCC, IntCC}; pub(crate) use cranelift_codegen::ir::function::Function; - pub(crate) use cranelift_codegen::ir::types; pub(crate) use cranelift_codegen::ir::{ - AbiParam, Block, FuncRef, Inst, InstBuilder, MemFlags, Signature, SourceLoc, StackSlot, - StackSlotData, StackSlotKind, TrapCode, Type, Value, + types, AbiParam, Block, FuncRef, Inst, InstBuilder, MemFlags, Signature, SourceLoc, + StackSlot, StackSlotData, StackSlotKind, TrapCode, Type, Value, }; pub(crate) use cranelift_codegen::Context; pub(crate) use cranelift_module::{self, DataDescription, FuncId, Linkage, Module}; diff --git a/src/main_shim.rs b/src/main_shim.rs index fe0a1551419..ba20a750d2b 100644 --- a/src/main_shim.rs +++ b/src/main_shim.rs @@ -1,7 +1,6 @@ use cranelift_frontend::{FunctionBuilder, FunctionBuilderContext}; use rustc_hir::LangItem; -use rustc_middle::ty::AssocKind; -use rustc_middle::ty::GenericArg; +use rustc_middle::ty::{AssocKind, GenericArg}; use rustc_session::config::{sigpipe, EntryFnType}; use rustc_span::symbol::Ident; use rustc_span::DUMMY_SP; diff --git a/src/optimize/peephole.rs b/src/optimize/peephole.rs index 26327dca299..c93fe935210 100644 --- a/src/optimize/peephole.rs +++ b/src/optimize/peephole.rs @@ -1,6 +1,7 @@ //! Peephole optimizations that can be performed while creating clif ir. -use cranelift_codegen::ir::{condcodes::IntCC, InstructionData, Opcode, Value, ValueDef}; +use cranelift_codegen::ir::condcodes::IntCC; +use cranelift_codegen::ir::{InstructionData, Opcode, Value, ValueDef}; use cranelift_frontend::FunctionBuilder; /// If the given value was produced by the lowering of `Rvalue::Not` return the input and true,