Skip to content

Commit 84ac80f

Browse files
committed
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 118f935 commit 84ac80f

File tree

1,865 files changed

+8163
-8995
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,865 files changed

+8163
-8995
lines changed

compiler/rustc_abi/src/layout.rs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
use std::borrow::{Borrow, Cow};
2-
use std::cmp;
32
use std::fmt::{self, Write};
4-
use std::iter;
5-
use std::ops::Bound;
6-
use std::ops::Deref;
3+
use std::ops::{Bound, Deref};
4+
use std::{cmp, iter};
75

86
use rustc_index::Idx;
97
use tracing::debug;
@@ -982,7 +980,8 @@ fn univariant<
982980
if repr.can_randomize_type_layout() && cfg!(feature = "randomize") {
983981
#[cfg(feature = "randomize")]
984982
{
985-
use rand::{seq::SliceRandom, SeedableRng};
983+
use rand::seq::SliceRandom;
984+
use rand::SeedableRng;
986985
// `ReprOptions.field_shuffle_seed` is a deterministic seed we can use to randomize field
987986
// ordering.
988987
let mut rng =

compiler/rustc_abi/src/lib.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,21 +6,20 @@
66
// tidy-alphabetical-end
77

88
use std::fmt;
9+
#[cfg(feature = "nightly")]
10+
use std::iter::Step;
911
use std::num::{NonZeroUsize, ParseIntError};
1012
use std::ops::{Add, AddAssign, Mul, RangeInclusive, Sub};
1113
use std::str::FromStr;
1214

1315
use bitflags::bitflags;
14-
use rustc_index::{Idx, IndexSlice, IndexVec};
15-
1616
#[cfg(feature = "nightly")]
1717
use rustc_data_structures::stable_hasher::StableOrd;
18+
use rustc_index::{Idx, IndexSlice, IndexVec};
1819
#[cfg(feature = "nightly")]
1920
use rustc_macros::HashStable_Generic;
2021
#[cfg(feature = "nightly")]
2122
use rustc_macros::{Decodable_Generic, Encodable_Generic};
22-
#[cfg(feature = "nightly")]
23-
use std::iter::Step;
2423

2524
mod layout;
2625
#[cfg(test)]

compiler/rustc_arena/src/lib.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,15 +27,14 @@
2727
#![feature(strict_provenance)]
2828
// tidy-alphabetical-end
2929

30-
use smallvec::SmallVec;
31-
3230
use std::alloc::Layout;
3331
use std::cell::{Cell, RefCell};
3432
use std::marker::PhantomData;
3533
use std::mem::{self, MaybeUninit};
3634
use std::ptr::{self, NonNull};
37-
use std::slice;
38-
use std::{cmp, intrinsics};
35+
use std::{cmp, intrinsics, slice};
36+
37+
use smallvec::SmallVec;
3938

4039
/// This calls the passed function while ensuring it won't be inlined into the caller.
4140
#[inline(never)]

compiler/rustc_arena/src/tests.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
extern crate test;
2-
use super::TypedArena;
32
use std::cell::Cell;
3+
44
use test::Bencher;
55

6+
use super::TypedArena;
7+
68
#[allow(dead_code)]
79
#[derive(Debug, Eq, PartialEq)]
810
struct Point {

compiler/rustc_ast/src/ast.rs

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,9 @@
1818
//! - [`Attribute`]: Metadata associated with item.
1919
//! - [`UnOp`], [`BinOp`], and [`BinOpKind`]: Unary and binary operators.
2020
21-
pub use crate::format::*;
22-
pub use crate::util::parser::ExprPrecedence;
23-
pub use rustc_span::AttrId;
24-
pub use GenericArgs::*;
25-
pub use UnsafeSource::*;
21+
use std::borrow::Cow;
22+
use std::{cmp, fmt, mem};
2623

27-
use crate::ptr::P;
28-
use crate::token::{self, CommentKind, Delimiter};
29-
use crate::tokenstream::{DelimSpan, LazyAttrTokenStream, TokenStream};
3024
pub use rustc_ast_ir::{Movability, Mutability};
3125
use rustc_data_structures::packed::Pu128;
3226
use rustc_data_structures::stable_hasher::{HashStable, StableHasher};
@@ -35,12 +29,17 @@ use rustc_data_structures::sync::Lrc;
3529
use rustc_macros::{Decodable, Encodable, HashStable_Generic};
3630
use rustc_span::source_map::{respan, Spanned};
3731
use rustc_span::symbol::{kw, sym, Ident, Symbol};
32+
pub use rustc_span::AttrId;
3833
use rustc_span::{ErrorGuaranteed, Span, DUMMY_SP};
39-
use std::borrow::Cow;
40-
use std::cmp;
41-
use std::fmt;
42-
use std::mem;
4334
use thin_vec::{thin_vec, ThinVec};
35+
pub use GenericArgs::*;
36+
pub use UnsafeSource::*;
37+
38+
pub use crate::format::*;
39+
use crate::ptr::P;
40+
use crate::token::{self, CommentKind, Delimiter};
41+
use crate::tokenstream::{DelimSpan, LazyAttrTokenStream, TokenStream};
42+
pub use crate::util::parser::ExprPrecedence;
4443

4544
/// A "Label" is an identifier of some point in sources,
4645
/// e.g. in the following code:
@@ -3491,8 +3490,9 @@ pub type ForeignItem = Item<ForeignItemKind>;
34913490
// Some nodes are used a lot. Make sure they don't unintentionally get bigger.
34923491
#[cfg(target_pointer_width = "64")]
34933492
mod size_asserts {
3494-
use super::*;
34953493
use rustc_data_structures::static_assert_size;
3494+
3495+
use super::*;
34963496
// tidy-alphabetical-start
34973497
static_assert_size!(AssocItem, 88);
34983498
static_assert_size!(AssocItemKind, 16);

compiler/rustc_ast/src/ast_traits.rs

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,17 @@
22
//! typically those used in AST fragments during macro expansion.
33
//! The traits are not implemented exhaustively, only when actually necessary.
44
5+
use std::fmt;
6+
use std::marker::PhantomData;
7+
58
use crate::ptr::P;
69
use crate::token::Nonterminal;
710
use crate::tokenstream::LazyAttrTokenStream;
8-
use crate::{Arm, Crate, ExprField, FieldDef, GenericParam, Param, PatField, Variant};
9-
use crate::{AssocItem, Expr, ForeignItem, Item, NodeId};
10-
use crate::{AttrItem, AttrKind, Block, Pat, Path, Ty, Visibility};
11-
use crate::{AttrVec, Attribute, Stmt, StmtKind};
12-
13-
use std::fmt;
14-
use std::marker::PhantomData;
11+
use crate::{
12+
Arm, AssocItem, AttrItem, AttrKind, AttrVec, Attribute, Block, Crate, Expr, ExprField,
13+
FieldDef, ForeignItem, GenericParam, Item, NodeId, Param, Pat, PatField, Path, Stmt, StmtKind,
14+
Ty, Variant, Visibility,
15+
};
1516

1617
/// A utility trait to reduce boilerplate.
1718
/// Standard `Deref(Mut)` cannot be reused due to coherence.

compiler/rustc_ast/src/attr/mod.rs

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,24 @@
11
//! Functions dealing with attributes and meta items.
22
3+
use std::iter;
4+
use std::sync::atomic::{AtomicU32, Ordering};
5+
6+
use rustc_index::bit_set::GrowableBitSet;
7+
use rustc_span::symbol::{sym, Ident, Symbol};
8+
use rustc_span::Span;
9+
use smallvec::{smallvec, SmallVec};
10+
use thin_vec::{thin_vec, ThinVec};
11+
312
use crate::ast::{
4-
AttrArgs, AttrArgsEq, AttrId, AttrItem, AttrKind, AttrStyle, AttrVec, Attribute, Safety,
13+
AttrArgs, AttrArgsEq, AttrId, AttrItem, AttrKind, AttrStyle, AttrVec, Attribute, DelimArgs,
14+
Expr, ExprKind, LitKind, MetaItem, MetaItemKind, MetaItemLit, NestedMetaItem, NormalAttr, Path,
15+
PathSegment, Safety, DUMMY_NODE_ID,
516
};
6-
use crate::ast::{DelimArgs, Expr, ExprKind, LitKind, MetaItemLit};
7-
use crate::ast::{MetaItem, MetaItemKind, NestedMetaItem, NormalAttr};
8-
use crate::ast::{Path, PathSegment, DUMMY_NODE_ID};
917
use crate::ptr::P;
1018
use crate::token::{self, CommentKind, Delimiter, Token};
11-
use crate::tokenstream::{DelimSpan, Spacing, TokenTree};
12-
use crate::tokenstream::{LazyAttrTokenStream, TokenStream};
19+
use crate::tokenstream::{DelimSpan, LazyAttrTokenStream, Spacing, TokenStream, TokenTree};
1320
use crate::util::comments;
1421
use crate::util::literal::escape_string_symbol;
15-
use rustc_index::bit_set::GrowableBitSet;
16-
use rustc_span::symbol::{sym, Ident, Symbol};
17-
use rustc_span::Span;
18-
use smallvec::{smallvec, SmallVec};
19-
use std::iter;
20-
use std::sync::atomic::{AtomicU32, Ordering};
21-
use thin_vec::{thin_vec, ThinVec};
2222

2323
pub struct MarkedAttrs(GrowableBitSet<AttrId>);
2424

compiler/rustc_ast/src/entry.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1-
use crate::{attr, Attribute};
21
use rustc_span::symbol::sym;
32
use rustc_span::Symbol;
43

4+
use crate::{attr, Attribute};
5+
56
#[derive(Debug)]
67
pub enum EntryPointType {
78
/// This function is not an entrypoint.

compiler/rustc_ast/src/expand/mod.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
//! Definitions shared by macros / syntax extensions and e.g. `rustc_middle`.
22
33
use rustc_macros::{Decodable, Encodable, HashStable_Generic};
4-
use rustc_span::{def_id::DefId, symbol::Ident};
4+
use rustc_span::def_id::DefId;
5+
use rustc_span::symbol::Ident;
56

67
use crate::MetaItem;
78

compiler/rustc_ast/src/format.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
1-
use crate::ptr::P;
2-
use crate::Expr;
31
use rustc_data_structures::fx::FxHashMap;
42
use rustc_macros::{Decodable, Encodable};
53
use rustc_span::symbol::{Ident, Symbol};
64
use rustc_span::Span;
75

6+
use crate::ptr::P;
7+
use crate::Expr;
8+
89
// Definitions:
910
//
1011
// format_args!("hello {abc:.xyz$}!!", abc="world");

0 commit comments

Comments
 (0)