Skip to content

Commit 1cbbac3

Browse files
nnethercoteGuillaumeGomez
authored andcommitted
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.
1 parent 88f7508 commit 1cbbac3

24 files changed

+69
-80
lines changed

build_system/src/build.rs

+5-4
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
1-
use crate::config::{Channel, ConfigInfo};
2-
use crate::utils::{
3-
copy_file, create_dir, get_sysroot_dir, run_command, run_command_with_output_and_env, walk_dir,
4-
};
51
use std::collections::HashMap;
62
use std::ffi::OsStr;
73
use std::fs;
84
use std::path::Path;
95

6+
use crate::config::{Channel, ConfigInfo};
7+
use crate::utils::{
8+
copy_file, create_dir, get_sysroot_dir, run_command, run_command_with_output_and_env, walk_dir,
9+
};
10+
1011
#[derive(Default)]
1112
struct BuildArg {
1213
flags: Vec<String>,

build_system/src/clean.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
use crate::utils::{get_sysroot_dir, remove_file, run_command};
2-
31
use std::fs::remove_dir_all;
42
use std::path::Path;
53

4+
use crate::utils::{get_sysroot_dir, remove_file, run_command};
5+
66
#[derive(Default)]
77
enum CleanArg {
88
/// `clean all`

build_system/src/clone_gcc.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1+
use std::path::{Path, PathBuf};
2+
13
use crate::config::ConfigInfo;
24
use crate::utils::{git_clone, run_command_with_output};
35

4-
use std::path::{Path, PathBuf};
5-
66
fn show_usage() {
77
println!(
88
r#"

build_system/src/config.rs

+8-7
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
1-
use crate::utils::{
2-
create_dir, create_symlink, get_os_name, get_sysroot_dir, run_command_with_output,
3-
rustc_version_info, split_args,
4-
};
51
use std::collections::HashMap;
6-
use std::env as std_env;
72
use std::ffi::OsStr;
8-
use std::fs;
93
use std::path::{Path, PathBuf};
4+
use std::{env as std_env, fs};
5+
6+
use boml::types::TomlValue;
7+
use boml::Toml;
108

11-
use boml::{types::TomlValue, Toml};
9+
use crate::utils::{
10+
create_dir, create_symlink, get_os_name, get_sysroot_dir, run_command_with_output,
11+
rustc_version_info, split_args,
12+
};
1213

1314
#[derive(Default, PartialEq, Eq, Clone, Copy, Debug)]
1415
pub enum Channel {

build_system/src/fmt.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1-
use crate::utils::run_command_with_output;
21
use std::ffi::OsStr;
32
use std::path::Path;
43

4+
use crate::utils::run_command_with_output;
5+
56
fn show_usage() {
67
println!(
78
r#"

build_system/src/main.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
use std::env;
2-
use std::process;
1+
use std::{env, process};
32

43
mod build;
54
mod clean;

build_system/src/prepare.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1+
use std::fs;
2+
use std::path::{Path, PathBuf};
3+
14
use crate::rustc_info::get_rustc_path;
25
use crate::utils::{
36
cargo_install, create_dir, get_sysroot_dir, git_clone_root_dir, remove_file, run_command,
47
run_command_with_output, walk_dir,
58
};
69

7-
use std::fs;
8-
use std::path::{Path, PathBuf};
9-
1010
fn prepare_libcore(
1111
sysroot_path: &Path,
1212
libgccjit12_patches: bool,

build_system/src/rust_tools.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1+
use std::collections::HashMap;
2+
use std::ffi::OsStr;
3+
use std::path::PathBuf;
4+
15
use crate::config::ConfigInfo;
26
use crate::utils::{
37
get_toolchain, run_command_with_output_and_env_no_err, rustc_toolchain_version_info,
48
rustc_version_info,
59
};
610

7-
use std::collections::HashMap;
8-
use std::ffi::OsStr;
9-
use std::path::PathBuf;
10-
1111
fn args(command: &str) -> Result<Option<Vec<String>>, String> {
1212
// We skip the binary and the "cargo"/"rustc" option.
1313
if let Some("--help") = std::env::args().skip(2).next().as_deref() {

build_system/src/test.rs

+7-7
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
use std::collections::HashMap;
2+
use std::ffi::OsStr;
3+
use std::fs::{remove_dir_all, File};
4+
use std::io::{BufRead, BufReader};
5+
use std::path::{Path, PathBuf};
6+
use std::str::FromStr;
7+
18
use crate::build;
29
use crate::config::{Channel, ConfigInfo};
310
use crate::utils::{
@@ -6,13 +13,6 @@ use crate::utils::{
613
split_args, walk_dir,
714
};
815

9-
use std::collections::HashMap;
10-
use std::ffi::OsStr;
11-
use std::fs::{remove_dir_all, File};
12-
use std::io::{BufRead, BufReader};
13-
use std::path::{Path, PathBuf};
14-
use std::str::FromStr;
15-
1616
type Env = HashMap<String, String>;
1717
type Runner = fn(&Env, &TestArg) -> Result<(), String>;
1818
type Runners = HashMap<&'static str, (&'static str, Runner)>;

src/archive.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,8 @@ use std::path::{Path, PathBuf};
33
use rustc_codegen_ssa::back::archive::{
44
ArArchiveBuilder, ArchiveBuilder, ArchiveBuilderBuilder, DEFAULT_OBJECT_READER,
55
};
6-
use rustc_session::Session;
7-
86
use rustc_session::cstore::DllImport;
7+
use rustc_session::Session;
98

109
pub(crate) struct ArArchiveBuilderBuilder;
1110

src/asm.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
use std::borrow::Cow;
2+
13
use gccjit::{LValue, RValue, ToRValue, Type};
24
use rustc_ast::ast::{InlineAsmOptions, InlineAsmTemplatePiece};
35
use rustc_codegen_ssa::mir::operand::OperandValue;
@@ -6,13 +8,11 @@ use rustc_codegen_ssa::traits::{
68
AsmBuilderMethods, AsmMethods, BaseTypeMethods, BuilderMethods, GlobalAsmOperandRef,
79
InlineAsmOperandRef,
810
};
9-
10-
use rustc_middle::{bug, ty::Instance};
11+
use rustc_middle::bug;
12+
use rustc_middle::ty::Instance;
1113
use rustc_span::Span;
1214
use rustc_target::asm::*;
1315

14-
use std::borrow::Cow;
15-
1616
use crate::builder::Builder;
1717
use crate::callee::get_fn;
1818
use crate::context::CodegenCx;

src/attributes.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,9 @@ use rustc_middle::middle::codegen_fn_attrs::CodegenFnAttrFlags;
99
use rustc_middle::ty;
1010
use rustc_span::symbol::sym;
1111

12+
use crate::context::CodegenCx;
13+
use crate::errors::TiedTargetFeatures;
1214
use crate::gcc_util::{check_tied_features, to_gcc_features};
13-
use crate::{context::CodegenCx, errors::TiedTargetFeatures};
1415

1516
/// Get GCC attribute for the provided inline heuristic.
1617
#[cfg(feature = "master")]

src/base.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,7 @@ use rustc_target::spec::PanicStrategy;
1919

2020
use crate::builder::Builder;
2121
use crate::context::CodegenCx;
22-
use crate::{gcc_util, new_context, LockedTargetInfo};
23-
use crate::{GccContext, SyncContext};
22+
use crate::{gcc_util, new_context, GccContext, LockedTargetInfo, SyncContext};
2423

2524
#[cfg(feature = "master")]
2625
pub fn visibility_to_gcc(linkage: Visibility) -> gccjit::Visibility {

src/builder.rs

+2-3
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,8 @@ use rustc_middle::ty::layout::{
2828
use rustc_middle::ty::{Instance, ParamEnv, Ty, TyCtxt};
2929
use rustc_span::def_id::DefId;
3030
use rustc_span::Span;
31-
use rustc_target::abi::{
32-
self, call::FnAbi, Align, HasDataLayout, Size, TargetDataLayout, WrappingRange,
33-
};
31+
use rustc_target::abi::call::FnAbi;
32+
use rustc_target::abi::{self, Align, HasDataLayout, Size, TargetDataLayout, WrappingRange};
3433
use rustc_target::spec::{HasTargetSpec, HasWasmCAbiOpt, Target, WasmCAbi};
3534

3635
use crate::common::{type_is_pointer, SignType, TypeReflection};

src/common.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
use gccjit::LValue;
2-
use gccjit::{RValue, ToRValue, Type};
1+
use gccjit::{LValue, RValue, ToRValue, Type};
32
use rustc_codegen_ssa::traits::{BaseTypeMethods, ConstMethods, MiscMethods, StaticMethods};
43
use rustc_middle::mir::interpret::{ConstAllocation, GlobalAlloc, Scalar};
54
use rustc_middle::mir::Mutability;

src/consts.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,13 @@ use gccjit::{FnAttribute, VarAttribute, Visibility};
33
use gccjit::{Function, GlobalKind, LValue, RValue, ToRValue, Type};
44
use rustc_codegen_ssa::traits::{BaseTypeMethods, ConstMethods, StaticMethods};
55
use rustc_hir::def::DefKind;
6-
use rustc_middle::bug;
76
use rustc_middle::middle::codegen_fn_attrs::{CodegenFnAttrFlags, CodegenFnAttrs};
87
use rustc_middle::mir::interpret::{
98
self, read_target_uint, ConstAllocation, ErrorHandled, Scalar as InterpScalar,
109
};
11-
use rustc_middle::span_bug;
1210
use rustc_middle::ty::layout::LayoutOf;
1311
use rustc_middle::ty::{self, Instance};
12+
use rustc_middle::{bug, span_bug};
1413
use rustc_span::def_id::DefId;
1514
use rustc_target::abi::{self, Align, HasDataLayout, Primitive, Size, WrappingRange};
1615

src/context.rs

+5-6
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,7 @@ use gccjit::{
66
use rustc_codegen_ssa::base::wants_msvc_seh;
77
use rustc_codegen_ssa::errors as ssa_errors;
88
use rustc_codegen_ssa::traits::{BackendTypes, BaseTypeMethods, MiscMethods};
9-
use rustc_data_structures::base_n::ToBaseN;
10-
use rustc_data_structures::base_n::ALPHANUMERIC_ONLY;
9+
use rustc_data_structures::base_n::{ToBaseN, ALPHANUMERIC_ONLY};
1110
use rustc_data_structures::fx::{FxHashMap, FxHashSet};
1211
use rustc_middle::mir::mono::CodegenUnit;
1312
use rustc_middle::span_bug;
@@ -17,10 +16,10 @@ use rustc_middle::ty::layout::{
1716
};
1817
use rustc_middle::ty::{self, Instance, ParamEnv, PolyExistentialTraitRef, Ty, TyCtxt};
1918
use rustc_session::Session;
20-
use rustc_span::{source_map::respan, Span, DUMMY_SP};
21-
use rustc_target::abi::{
22-
call::FnAbi, HasDataLayout, PointeeInfo, Size, TargetDataLayout, VariantIdx,
23-
};
19+
use rustc_span::source_map::respan;
20+
use rustc_span::{Span, DUMMY_SP};
21+
use rustc_target::abi::call::FnAbi;
22+
use rustc_target::abi::{HasDataLayout, PointeeInfo, Size, TargetDataLayout, VariantIdx};
2423
use rustc_target::spec::{HasTargetSpec, HasWasmCAbiOpt, Target, TlsModel, WasmCAbi};
2524

2625
use crate::callee::get_fn;

src/debuginfo.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
use std::ops::Range;
2+
13
use gccjit::{Location, RValue};
24
use rustc_codegen_ssa::mir::debuginfo::{DebugScope, FunctionDebugContext, VariableKind};
35
use rustc_codegen_ssa::traits::{DebugInfoBuilderMethods, DebugInfoMethods};
@@ -10,7 +12,6 @@ use rustc_session::config::DebugInfo;
1012
use rustc_span::{BytePos, Pos, SourceFile, SourceFileAndLine, Span, Symbol};
1113
use rustc_target::abi::call::FnAbi;
1214
use rustc_target::abi::Size;
13-
use std::ops::Range;
1415

1516
use crate::builder::Builder;
1617
use crate::context::CodegenCx;

src/gcc_util.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
#[cfg(feature = "master")]
22
use gccjit::Context;
3-
use smallvec::{smallvec, SmallVec};
4-
53
use rustc_data_structures::fx::FxHashMap;
64
use rustc_middle::bug;
75
use rustc_session::Session;
86
use rustc_target::target_features::RUSTC_SPECIFIC_FEATURES;
7+
use smallvec::{smallvec, SmallVec};
98

109
use crate::errors::{
1110
PossibleFeature, TargetFeatureDisableOrEnable, UnknownCTargetFeature,

src/int.rs

+8-11
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,13 @@ use gccjit::{BinaryOp, ComparisonOp, FunctionType, Location, RValue, ToRValue, T
66
use rustc_codegen_ssa::common::{IntPredicate, TypeKind};
77
use rustc_codegen_ssa::traits::{BackendTypes, BaseTypeMethods, BuilderMethods, OverflowOp};
88
use rustc_middle::ty::{ParamEnv, Ty};
9-
use rustc_target::abi::{
10-
call::{ArgAbi, ArgAttributes, Conv, FnAbi, PassMode},
11-
Endian,
12-
};
9+
use rustc_target::abi::call::{ArgAbi, ArgAttributes, Conv, FnAbi, PassMode};
10+
use rustc_target::abi::Endian;
1311
use rustc_target::spec;
1412

15-
use crate::builder::ToGccComp;
16-
use crate::{
17-
builder::Builder,
18-
common::{SignType, TypeReflection},
19-
context::CodegenCx,
20-
};
13+
use crate::builder::{Builder, ToGccComp};
14+
use crate::common::{SignType, TypeReflection};
15+
use crate::context::CodegenCx;
2116

2217
impl<'a, 'gcc, 'tcx> Builder<'a, 'gcc, 'tcx> {
2318
pub fn gcc_urem(&self, a: RValue<'gcc>, b: RValue<'gcc>) -> RValue<'gcc> {
@@ -266,7 +261,9 @@ impl<'a, 'gcc, 'tcx> Builder<'a, 'gcc, 'tcx> {
266261
lhs: <Self as BackendTypes>::Value,
267262
rhs: <Self as BackendTypes>::Value,
268263
) -> (<Self as BackendTypes>::Value, <Self as BackendTypes>::Value) {
269-
use rustc_middle::ty::{Int, IntTy::*, Uint, UintTy::*};
264+
use rustc_middle::ty::IntTy::*;
265+
use rustc_middle::ty::UintTy::*;
266+
use rustc_middle::ty::{Int, Uint};
270267

271268
let new_kind = match *typ.kind() {
272269
Int(t @ Isize) => Int(t.normalize(self.tcx.sess.target.pointer_width)),

src/intrinsic/llvm.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@ use std::borrow::Cow;
33
use gccjit::{Function, FunctionPtrType, RValue, ToRValue, UnaryOp};
44
use rustc_codegen_ssa::traits::BuilderMethods;
55

6-
use crate::{builder::Builder, context::CodegenCx};
6+
use crate::builder::Builder;
7+
use crate::context::CodegenCx;
78

89
pub fn adjust_intrinsic_arguments<'a, 'b, 'gcc, 'tcx>(
910
builder: &Builder<'a, 'gcc, 'tcx>,

src/intrinsic/simd.rs

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
11
use std::iter::FromIterator;
22

3-
use gccjit::ToRValue;
4-
use gccjit::{BinaryOp, RValue, Type};
3+
use gccjit::{BinaryOp, RValue, ToRValue, Type};
54
#[cfg(feature = "master")]
65
use gccjit::{ComparisonOp, UnaryOp};
7-
86
use rustc_codegen_ssa::base::compare_simd_types;
97
use rustc_codegen_ssa::common::{IntPredicate, TypeKind};
108
#[cfg(feature = "master")]

src/lib.rs

+3-6
Original file line numberDiff line numberDiff line change
@@ -79,14 +79,11 @@ use std::ops::Deref;
7979
use std::sync::atomic::AtomicBool;
8080
#[cfg(not(feature = "master"))]
8181
use std::sync::atomic::Ordering;
82-
use std::sync::Arc;
83-
use std::sync::Mutex;
82+
use std::sync::{Arc, Mutex};
8483

85-
use back::lto::ThinBuffer;
86-
use back::lto::ThinData;
84+
use back::lto::{ThinBuffer, ThinData};
8785
use errors::LTONotSupported;
88-
use gccjit::CType;
89-
use gccjit::{Context, OptimizationLevel};
86+
use gccjit::{CType, Context, OptimizationLevel};
9087
#[cfg(feature = "master")]
9188
use gccjit::{TargetInfo, Version};
9289
use rustc_ast::expand::allocator::AllocatorKind;

src/mono_item.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,9 @@ use rustc_middle::mir::mono::{Linkage, Visibility};
99
use rustc_middle::ty::layout::{FnAbiOf, LayoutOf};
1010
use rustc_middle::ty::{self, Instance, TypeVisitableExt};
1111

12-
use crate::attributes;
13-
use crate::base;
1412
use crate::context::CodegenCx;
1513
use crate::type_of::LayoutGccExt;
14+
use crate::{attributes, base};
1615

1716
impl<'gcc, 'tcx> PreDefineMethods<'tcx> for CodegenCx<'gcc, 'tcx> {
1817
#[cfg_attr(not(feature = "master"), allow(unused_variables))]

0 commit comments

Comments
 (0)