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.
This commit is contained in:
Nicholas Nethercote 2024-07-29 08:13:50 +10:00 committed by Guillaume Gomez
parent 88f7508da7
commit 1cbbac3911
24 changed files with 69 additions and 80 deletions

View File

@ -1,12 +1,13 @@
use crate::config::{Channel, ConfigInfo};
use crate::utils::{
copy_file, create_dir, get_sysroot_dir, run_command, run_command_with_output_and_env, walk_dir,
};
use std::collections::HashMap; use std::collections::HashMap;
use std::ffi::OsStr; use std::ffi::OsStr;
use std::fs; use std::fs;
use std::path::Path; use std::path::Path;
use crate::config::{Channel, ConfigInfo};
use crate::utils::{
copy_file, create_dir, get_sysroot_dir, run_command, run_command_with_output_and_env, walk_dir,
};
#[derive(Default)] #[derive(Default)]
struct BuildArg { struct BuildArg {
flags: Vec<String>, flags: Vec<String>,

View File

@ -1,8 +1,8 @@
use crate::utils::{get_sysroot_dir, remove_file, run_command};
use std::fs::remove_dir_all; use std::fs::remove_dir_all;
use std::path::Path; use std::path::Path;
use crate::utils::{get_sysroot_dir, remove_file, run_command};
#[derive(Default)] #[derive(Default)]
enum CleanArg { enum CleanArg {
/// `clean all` /// `clean all`

View File

@ -1,8 +1,8 @@
use std::path::{Path, PathBuf};
use crate::config::ConfigInfo; use crate::config::ConfigInfo;
use crate::utils::{git_clone, run_command_with_output}; use crate::utils::{git_clone, run_command_with_output};
use std::path::{Path, PathBuf};
fn show_usage() { fn show_usage() {
println!( println!(
r#" r#"

View File

@ -1,14 +1,15 @@
use std::collections::HashMap;
use std::ffi::OsStr;
use std::path::{Path, PathBuf};
use std::{env as std_env, fs};
use boml::types::TomlValue;
use boml::Toml;
use crate::utils::{ use crate::utils::{
create_dir, create_symlink, get_os_name, get_sysroot_dir, run_command_with_output, create_dir, create_symlink, get_os_name, get_sysroot_dir, run_command_with_output,
rustc_version_info, split_args, rustc_version_info, split_args,
}; };
use std::collections::HashMap;
use std::env as std_env;
use std::ffi::OsStr;
use std::fs;
use std::path::{Path, PathBuf};
use boml::{types::TomlValue, Toml};
#[derive(Default, PartialEq, Eq, Clone, Copy, Debug)] #[derive(Default, PartialEq, Eq, Clone, Copy, Debug)]
pub enum Channel { pub enum Channel {

View File

@ -1,7 +1,8 @@
use crate::utils::run_command_with_output;
use std::ffi::OsStr; use std::ffi::OsStr;
use std::path::Path; use std::path::Path;
use crate::utils::run_command_with_output;
fn show_usage() { fn show_usage() {
println!( println!(
r#" r#"

View File

@ -1,5 +1,4 @@
use std::env; use std::{env, process};
use std::process;
mod build; mod build;
mod clean; mod clean;

View File

@ -1,12 +1,12 @@
use std::fs;
use std::path::{Path, PathBuf};
use crate::rustc_info::get_rustc_path; use crate::rustc_info::get_rustc_path;
use crate::utils::{ use crate::utils::{
cargo_install, create_dir, get_sysroot_dir, git_clone_root_dir, remove_file, run_command, cargo_install, create_dir, get_sysroot_dir, git_clone_root_dir, remove_file, run_command,
run_command_with_output, walk_dir, run_command_with_output, walk_dir,
}; };
use std::fs;
use std::path::{Path, PathBuf};
fn prepare_libcore( fn prepare_libcore(
sysroot_path: &Path, sysroot_path: &Path,
libgccjit12_patches: bool, libgccjit12_patches: bool,

View File

@ -1,13 +1,13 @@
use std::collections::HashMap;
use std::ffi::OsStr;
use std::path::PathBuf;
use crate::config::ConfigInfo; use crate::config::ConfigInfo;
use crate::utils::{ use crate::utils::{
get_toolchain, run_command_with_output_and_env_no_err, rustc_toolchain_version_info, get_toolchain, run_command_with_output_and_env_no_err, rustc_toolchain_version_info,
rustc_version_info, rustc_version_info,
}; };
use std::collections::HashMap;
use std::ffi::OsStr;
use std::path::PathBuf;
fn args(command: &str) -> Result<Option<Vec<String>>, String> { fn args(command: &str) -> Result<Option<Vec<String>>, String> {
// We skip the binary and the "cargo"/"rustc" option. // We skip the binary and the "cargo"/"rustc" option.
if let Some("--help") = std::env::args().skip(2).next().as_deref() { if let Some("--help") = std::env::args().skip(2).next().as_deref() {

View File

@ -1,3 +1,10 @@
use std::collections::HashMap;
use std::ffi::OsStr;
use std::fs::{remove_dir_all, File};
use std::io::{BufRead, BufReader};
use std::path::{Path, PathBuf};
use std::str::FromStr;
use crate::build; use crate::build;
use crate::config::{Channel, ConfigInfo}; use crate::config::{Channel, ConfigInfo};
use crate::utils::{ use crate::utils::{
@ -6,13 +13,6 @@
split_args, walk_dir, split_args, walk_dir,
}; };
use std::collections::HashMap;
use std::ffi::OsStr;
use std::fs::{remove_dir_all, File};
use std::io::{BufRead, BufReader};
use std::path::{Path, PathBuf};
use std::str::FromStr;
type Env = HashMap<String, String>; type Env = HashMap<String, String>;
type Runner = fn(&Env, &TestArg) -> Result<(), String>; type Runner = fn(&Env, &TestArg) -> Result<(), String>;
type Runners = HashMap<&'static str, (&'static str, Runner)>; type Runners = HashMap<&'static str, (&'static str, Runner)>;

View File

@ -3,9 +3,8 @@
use rustc_codegen_ssa::back::archive::{ use rustc_codegen_ssa::back::archive::{
ArArchiveBuilder, ArchiveBuilder, ArchiveBuilderBuilder, DEFAULT_OBJECT_READER, ArArchiveBuilder, ArchiveBuilder, ArchiveBuilderBuilder, DEFAULT_OBJECT_READER,
}; };
use rustc_session::Session;
use rustc_session::cstore::DllImport; use rustc_session::cstore::DllImport;
use rustc_session::Session;
pub(crate) struct ArArchiveBuilderBuilder; pub(crate) struct ArArchiveBuilderBuilder;

View File

@ -1,3 +1,5 @@
use std::borrow::Cow;
use gccjit::{LValue, RValue, ToRValue, Type}; use gccjit::{LValue, RValue, ToRValue, Type};
use rustc_ast::ast::{InlineAsmOptions, InlineAsmTemplatePiece}; use rustc_ast::ast::{InlineAsmOptions, InlineAsmTemplatePiece};
use rustc_codegen_ssa::mir::operand::OperandValue; use rustc_codegen_ssa::mir::operand::OperandValue;
@ -6,13 +8,11 @@
AsmBuilderMethods, AsmMethods, BaseTypeMethods, BuilderMethods, GlobalAsmOperandRef, AsmBuilderMethods, AsmMethods, BaseTypeMethods, BuilderMethods, GlobalAsmOperandRef,
InlineAsmOperandRef, InlineAsmOperandRef,
}; };
use rustc_middle::bug;
use rustc_middle::{bug, ty::Instance}; use rustc_middle::ty::Instance;
use rustc_span::Span; use rustc_span::Span;
use rustc_target::asm::*; use rustc_target::asm::*;
use std::borrow::Cow;
use crate::builder::Builder; use crate::builder::Builder;
use crate::callee::get_fn; use crate::callee::get_fn;
use crate::context::CodegenCx; use crate::context::CodegenCx;

View File

@ -9,8 +9,9 @@
use rustc_middle::ty; use rustc_middle::ty;
use rustc_span::symbol::sym; use rustc_span::symbol::sym;
use crate::context::CodegenCx;
use crate::errors::TiedTargetFeatures;
use crate::gcc_util::{check_tied_features, to_gcc_features}; use crate::gcc_util::{check_tied_features, to_gcc_features};
use crate::{context::CodegenCx, errors::TiedTargetFeatures};
/// Get GCC attribute for the provided inline heuristic. /// Get GCC attribute for the provided inline heuristic.
#[cfg(feature = "master")] #[cfg(feature = "master")]

View File

@ -19,8 +19,7 @@
use crate::builder::Builder; use crate::builder::Builder;
use crate::context::CodegenCx; use crate::context::CodegenCx;
use crate::{gcc_util, new_context, LockedTargetInfo}; use crate::{gcc_util, new_context, GccContext, LockedTargetInfo, SyncContext};
use crate::{GccContext, SyncContext};
#[cfg(feature = "master")] #[cfg(feature = "master")]
pub fn visibility_to_gcc(linkage: Visibility) -> gccjit::Visibility { pub fn visibility_to_gcc(linkage: Visibility) -> gccjit::Visibility {

View File

@ -28,9 +28,8 @@
use rustc_middle::ty::{Instance, ParamEnv, Ty, TyCtxt}; use rustc_middle::ty::{Instance, ParamEnv, Ty, TyCtxt};
use rustc_span::def_id::DefId; use rustc_span::def_id::DefId;
use rustc_span::Span; use rustc_span::Span;
use rustc_target::abi::{ use rustc_target::abi::call::FnAbi;
self, call::FnAbi, Align, HasDataLayout, Size, TargetDataLayout, WrappingRange, use rustc_target::abi::{self, Align, HasDataLayout, Size, TargetDataLayout, WrappingRange};
};
use rustc_target::spec::{HasTargetSpec, HasWasmCAbiOpt, Target, WasmCAbi}; use rustc_target::spec::{HasTargetSpec, HasWasmCAbiOpt, Target, WasmCAbi};
use crate::common::{type_is_pointer, SignType, TypeReflection}; use crate::common::{type_is_pointer, SignType, TypeReflection};

View File

@ -1,5 +1,4 @@
use gccjit::LValue; use gccjit::{LValue, RValue, ToRValue, Type};
use gccjit::{RValue, ToRValue, Type};
use rustc_codegen_ssa::traits::{BaseTypeMethods, ConstMethods, MiscMethods, StaticMethods}; use rustc_codegen_ssa::traits::{BaseTypeMethods, ConstMethods, MiscMethods, StaticMethods};
use rustc_middle::mir::interpret::{ConstAllocation, GlobalAlloc, Scalar}; use rustc_middle::mir::interpret::{ConstAllocation, GlobalAlloc, Scalar};
use rustc_middle::mir::Mutability; use rustc_middle::mir::Mutability;

View File

@ -3,14 +3,13 @@
use gccjit::{Function, GlobalKind, LValue, RValue, ToRValue, Type}; use gccjit::{Function, GlobalKind, LValue, RValue, ToRValue, Type};
use rustc_codegen_ssa::traits::{BaseTypeMethods, ConstMethods, StaticMethods}; use rustc_codegen_ssa::traits::{BaseTypeMethods, ConstMethods, StaticMethods};
use rustc_hir::def::DefKind; use rustc_hir::def::DefKind;
use rustc_middle::bug;
use rustc_middle::middle::codegen_fn_attrs::{CodegenFnAttrFlags, CodegenFnAttrs}; use rustc_middle::middle::codegen_fn_attrs::{CodegenFnAttrFlags, CodegenFnAttrs};
use rustc_middle::mir::interpret::{ use rustc_middle::mir::interpret::{
self, read_target_uint, ConstAllocation, ErrorHandled, Scalar as InterpScalar, self, read_target_uint, ConstAllocation, ErrorHandled, Scalar as InterpScalar,
}; };
use rustc_middle::span_bug;
use rustc_middle::ty::layout::LayoutOf; use rustc_middle::ty::layout::LayoutOf;
use rustc_middle::ty::{self, Instance}; use rustc_middle::ty::{self, Instance};
use rustc_middle::{bug, span_bug};
use rustc_span::def_id::DefId; use rustc_span::def_id::DefId;
use rustc_target::abi::{self, Align, HasDataLayout, Primitive, Size, WrappingRange}; use rustc_target::abi::{self, Align, HasDataLayout, Primitive, Size, WrappingRange};

View File

@ -6,8 +6,7 @@
use rustc_codegen_ssa::base::wants_msvc_seh; use rustc_codegen_ssa::base::wants_msvc_seh;
use rustc_codegen_ssa::errors as ssa_errors; use rustc_codegen_ssa::errors as ssa_errors;
use rustc_codegen_ssa::traits::{BackendTypes, BaseTypeMethods, MiscMethods}; use rustc_codegen_ssa::traits::{BackendTypes, BaseTypeMethods, MiscMethods};
use rustc_data_structures::base_n::ToBaseN; use rustc_data_structures::base_n::{ToBaseN, ALPHANUMERIC_ONLY};
use rustc_data_structures::base_n::ALPHANUMERIC_ONLY;
use rustc_data_structures::fx::{FxHashMap, FxHashSet}; use rustc_data_structures::fx::{FxHashMap, FxHashSet};
use rustc_middle::mir::mono::CodegenUnit; use rustc_middle::mir::mono::CodegenUnit;
use rustc_middle::span_bug; use rustc_middle::span_bug;
@ -17,10 +16,10 @@
}; };
use rustc_middle::ty::{self, Instance, ParamEnv, PolyExistentialTraitRef, Ty, TyCtxt}; use rustc_middle::ty::{self, Instance, ParamEnv, PolyExistentialTraitRef, Ty, TyCtxt};
use rustc_session::Session; use rustc_session::Session;
use rustc_span::{source_map::respan, Span, DUMMY_SP}; use rustc_span::source_map::respan;
use rustc_target::abi::{ use rustc_span::{Span, DUMMY_SP};
call::FnAbi, HasDataLayout, PointeeInfo, Size, TargetDataLayout, VariantIdx, use rustc_target::abi::call::FnAbi;
}; use rustc_target::abi::{HasDataLayout, PointeeInfo, Size, TargetDataLayout, VariantIdx};
use rustc_target::spec::{HasTargetSpec, HasWasmCAbiOpt, Target, TlsModel, WasmCAbi}; use rustc_target::spec::{HasTargetSpec, HasWasmCAbiOpt, Target, TlsModel, WasmCAbi};
use crate::callee::get_fn; use crate::callee::get_fn;

View File

@ -1,3 +1,5 @@
use std::ops::Range;
use gccjit::{Location, RValue}; use gccjit::{Location, RValue};
use rustc_codegen_ssa::mir::debuginfo::{DebugScope, FunctionDebugContext, VariableKind}; use rustc_codegen_ssa::mir::debuginfo::{DebugScope, FunctionDebugContext, VariableKind};
use rustc_codegen_ssa::traits::{DebugInfoBuilderMethods, DebugInfoMethods}; use rustc_codegen_ssa::traits::{DebugInfoBuilderMethods, DebugInfoMethods};
@ -10,7 +12,6 @@
use rustc_span::{BytePos, Pos, SourceFile, SourceFileAndLine, Span, Symbol}; use rustc_span::{BytePos, Pos, SourceFile, SourceFileAndLine, Span, Symbol};
use rustc_target::abi::call::FnAbi; use rustc_target::abi::call::FnAbi;
use rustc_target::abi::Size; use rustc_target::abi::Size;
use std::ops::Range;
use crate::builder::Builder; use crate::builder::Builder;
use crate::context::CodegenCx; use crate::context::CodegenCx;

View File

@ -1,11 +1,10 @@
#[cfg(feature = "master")] #[cfg(feature = "master")]
use gccjit::Context; use gccjit::Context;
use smallvec::{smallvec, SmallVec};
use rustc_data_structures::fx::FxHashMap; use rustc_data_structures::fx::FxHashMap;
use rustc_middle::bug; use rustc_middle::bug;
use rustc_session::Session; use rustc_session::Session;
use rustc_target::target_features::RUSTC_SPECIFIC_FEATURES; use rustc_target::target_features::RUSTC_SPECIFIC_FEATURES;
use smallvec::{smallvec, SmallVec};
use crate::errors::{ use crate::errors::{
PossibleFeature, TargetFeatureDisableOrEnable, UnknownCTargetFeature, PossibleFeature, TargetFeatureDisableOrEnable, UnknownCTargetFeature,

View File

@ -6,18 +6,13 @@
use rustc_codegen_ssa::common::{IntPredicate, TypeKind}; use rustc_codegen_ssa::common::{IntPredicate, TypeKind};
use rustc_codegen_ssa::traits::{BackendTypes, BaseTypeMethods, BuilderMethods, OverflowOp}; use rustc_codegen_ssa::traits::{BackendTypes, BaseTypeMethods, BuilderMethods, OverflowOp};
use rustc_middle::ty::{ParamEnv, Ty}; use rustc_middle::ty::{ParamEnv, Ty};
use rustc_target::abi::{ use rustc_target::abi::call::{ArgAbi, ArgAttributes, Conv, FnAbi, PassMode};
call::{ArgAbi, ArgAttributes, Conv, FnAbi, PassMode}, use rustc_target::abi::Endian;
Endian,
};
use rustc_target::spec; use rustc_target::spec;
use crate::builder::ToGccComp; use crate::builder::{Builder, ToGccComp};
use crate::{ use crate::common::{SignType, TypeReflection};
builder::Builder, use crate::context::CodegenCx;
common::{SignType, TypeReflection},
context::CodegenCx,
};
impl<'a, 'gcc, 'tcx> Builder<'a, 'gcc, 'tcx> { impl<'a, 'gcc, 'tcx> Builder<'a, 'gcc, 'tcx> {
pub fn gcc_urem(&self, a: RValue<'gcc>, b: RValue<'gcc>) -> RValue<'gcc> { pub fn gcc_urem(&self, a: RValue<'gcc>, b: RValue<'gcc>) -> RValue<'gcc> {
@ -266,7 +261,9 @@ pub fn gcc_checked_binop(
lhs: <Self as BackendTypes>::Value, lhs: <Self as BackendTypes>::Value,
rhs: <Self as BackendTypes>::Value, rhs: <Self as BackendTypes>::Value,
) -> (<Self as BackendTypes>::Value, <Self as BackendTypes>::Value) { ) -> (<Self as BackendTypes>::Value, <Self as BackendTypes>::Value) {
use rustc_middle::ty::{Int, IntTy::*, Uint, UintTy::*}; use rustc_middle::ty::IntTy::*;
use rustc_middle::ty::UintTy::*;
use rustc_middle::ty::{Int, Uint};
let new_kind = match *typ.kind() { let new_kind = match *typ.kind() {
Int(t @ Isize) => Int(t.normalize(self.tcx.sess.target.pointer_width)), Int(t @ Isize) => Int(t.normalize(self.tcx.sess.target.pointer_width)),

View File

@ -3,7 +3,8 @@
use gccjit::{Function, FunctionPtrType, RValue, ToRValue, UnaryOp}; use gccjit::{Function, FunctionPtrType, RValue, ToRValue, UnaryOp};
use rustc_codegen_ssa::traits::BuilderMethods; use rustc_codegen_ssa::traits::BuilderMethods;
use crate::{builder::Builder, context::CodegenCx}; use crate::builder::Builder;
use crate::context::CodegenCx;
pub fn adjust_intrinsic_arguments<'a, 'b, 'gcc, 'tcx>( pub fn adjust_intrinsic_arguments<'a, 'b, 'gcc, 'tcx>(
builder: &Builder<'a, 'gcc, 'tcx>, builder: &Builder<'a, 'gcc, 'tcx>,

View File

@ -1,10 +1,8 @@
use std::iter::FromIterator; use std::iter::FromIterator;
use gccjit::ToRValue; use gccjit::{BinaryOp, RValue, ToRValue, Type};
use gccjit::{BinaryOp, RValue, Type};
#[cfg(feature = "master")] #[cfg(feature = "master")]
use gccjit::{ComparisonOp, UnaryOp}; use gccjit::{ComparisonOp, UnaryOp};
use rustc_codegen_ssa::base::compare_simd_types; use rustc_codegen_ssa::base::compare_simd_types;
use rustc_codegen_ssa::common::{IntPredicate, TypeKind}; use rustc_codegen_ssa::common::{IntPredicate, TypeKind};
#[cfg(feature = "master")] #[cfg(feature = "master")]

View File

@ -79,14 +79,11 @@
use std::sync::atomic::AtomicBool; use std::sync::atomic::AtomicBool;
#[cfg(not(feature = "master"))] #[cfg(not(feature = "master"))]
use std::sync::atomic::Ordering; use std::sync::atomic::Ordering;
use std::sync::Arc; use std::sync::{Arc, Mutex};
use std::sync::Mutex;
use back::lto::ThinBuffer; use back::lto::{ThinBuffer, ThinData};
use back::lto::ThinData;
use errors::LTONotSupported; use errors::LTONotSupported;
use gccjit::CType; use gccjit::{CType, Context, OptimizationLevel};
use gccjit::{Context, OptimizationLevel};
#[cfg(feature = "master")] #[cfg(feature = "master")]
use gccjit::{TargetInfo, Version}; use gccjit::{TargetInfo, Version};
use rustc_ast::expand::allocator::AllocatorKind; use rustc_ast::expand::allocator::AllocatorKind;

View File

@ -9,10 +9,9 @@
use rustc_middle::ty::layout::{FnAbiOf, LayoutOf}; use rustc_middle::ty::layout::{FnAbiOf, LayoutOf};
use rustc_middle::ty::{self, Instance, TypeVisitableExt}; use rustc_middle::ty::{self, Instance, TypeVisitableExt};
use crate::attributes;
use crate::base;
use crate::context::CodegenCx; use crate::context::CodegenCx;
use crate::type_of::LayoutGccExt; use crate::type_of::LayoutGccExt;
use crate::{attributes, base};
impl<'gcc, 'tcx> PreDefineMethods<'tcx> for CodegenCx<'gcc, 'tcx> { impl<'gcc, 'tcx> PreDefineMethods<'tcx> for CodegenCx<'gcc, 'tcx> {
#[cfg_attr(not(feature = "master"), allow(unused_variables))] #[cfg_attr(not(feature = "master"), allow(unused_variables))]