1
Fork 0

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
parent 118f9350c5
commit 84ac80f192
1865 changed files with 8367 additions and 9199 deletions

View file

@ -1,5 +1,5 @@
use crate::definitions::DefPathData;
use crate::hir;
use std::array::IntoIter;
use std::fmt::Debug;
use rustc_ast as ast;
use rustc_ast::NodeId;
@ -11,8 +11,8 @@ use rustc_span::hygiene::MacroKind;
use rustc_span::symbol::kw;
use rustc_span::Symbol;
use std::array::IntoIter;
use std::fmt::Debug;
use crate::definitions::DefPathData;
use crate::hir;
/// Encodes if a `DefKind::Ctor` is the constructor of an enum variant or a struct.
#[derive(Clone, Copy, PartialEq, Eq, Encodable, Decodable, Hash, Debug, HashStable_Generic)]

View file

@ -4,18 +4,20 @@
//! There are also some rather random cases (like const initializer
//! expressions) that are mostly just leftovers.
pub use crate::def_id::DefPathHash;
use crate::def_id::{CrateNum, DefIndex, LocalDefId, StableCrateId, CRATE_DEF_INDEX, LOCAL_CRATE};
use crate::def_path_hash_map::DefPathHashMap;
use std::fmt::{self, Write};
use std::hash::Hash;
use rustc_data_structures::stable_hasher::{Hash64, StableHasher};
use rustc_data_structures::unord::UnordMap;
use rustc_index::IndexVec;
use rustc_macros::{Decodable, Encodable};
use rustc_span::symbol::{kw, sym, Symbol};
use std::fmt::{self, Write};
use std::hash::Hash;
use tracing::{debug, instrument};
pub use crate::def_id::DefPathHash;
use crate::def_id::{CrateNum, DefIndex, LocalDefId, StableCrateId, CRATE_DEF_INDEX, LOCAL_CRATE};
use crate::def_path_hash_map::DefPathHashMap;
/// The `DefPathTable` maps `DefIndex`es to `DefKey`s and vice versa.
/// Internally the `DefPathTable` holds a tree of `DefKey`s, where each `DefKey`
/// stores the `DefIndex` of its parent.

View file

@ -1,9 +1,10 @@
use crate::def_id::DefId;
use rustc_data_structures::fx::FxIndexMap;
use rustc_data_structures::stable_hasher::{HashStable, StableHasher};
use rustc_span::def_id::DefIdMap;
use rustc_span::Symbol;
use crate::def_id::DefId;
#[derive(Debug, Default)]
pub struct DiagnosticItems {
pub id_to_name: DefIdMap<Symbol>,

View file

@ -1,28 +1,34 @@
use std::fmt;
use rustc_ast as ast;
use rustc_ast::util::parser::ExprPrecedence;
use rustc_ast::{
Attribute, FloatTy, InlineAsmOptions, InlineAsmTemplatePiece, IntTy, Label, LitKind,
TraitObjectSyntax, UintTy,
};
pub use rustc_ast::{
BinOp, BinOpKind, BindingMode, BorrowKind, ByRef, CaptureBy, ImplPolarity, IsAuto, Movability,
Mutability, UnOp,
};
use rustc_data_structures::fingerprint::Fingerprint;
use rustc_data_structures::sorted_map::SortedMap;
use rustc_index::IndexVec;
use rustc_macros::{Decodable, Encodable, HashStable_Generic};
use rustc_span::def_id::LocalDefId;
use rustc_span::hygiene::MacroKind;
use rustc_span::source_map::Spanned;
use rustc_span::symbol::{kw, sym, Ident, Symbol};
use rustc_span::{BytePos, ErrorGuaranteed, Span, DUMMY_SP};
use rustc_target::asm::InlineAsmRegOrRegClass;
use rustc_target::spec::abi::Abi;
use smallvec::SmallVec;
use tracing::debug;
use crate::def::{CtorKind, DefKind, Res};
use crate::def_id::{DefId, LocalDefIdMap};
pub(crate) use crate::hir_id::{HirId, ItemLocalId, ItemLocalMap, OwnerId};
use crate::intravisit::FnKind;
use crate::LangItem;
use rustc_ast as ast;
use rustc_ast::util::parser::ExprPrecedence;
use rustc_ast::{Attribute, FloatTy, IntTy, Label, LitKind, TraitObjectSyntax, UintTy};
pub use rustc_ast::{BinOp, BinOpKind, BindingMode, BorrowKind, ByRef, CaptureBy};
pub use rustc_ast::{ImplPolarity, IsAuto, Movability, Mutability, UnOp};
use rustc_ast::{InlineAsmOptions, InlineAsmTemplatePiece};
use rustc_data_structures::fingerprint::Fingerprint;
use rustc_data_structures::sorted_map::SortedMap;
use rustc_index::IndexVec;
use rustc_macros::{Decodable, Encodable, HashStable_Generic};
use rustc_span::hygiene::MacroKind;
use rustc_span::source_map::Spanned;
use rustc_span::symbol::{kw, sym, Ident, Symbol};
use rustc_span::ErrorGuaranteed;
use rustc_span::{def_id::LocalDefId, BytePos, Span, DUMMY_SP};
use rustc_target::asm::InlineAsmRegOrRegClass;
use rustc_target::spec::abi::Abi;
use smallvec::SmallVec;
use std::fmt;
use tracing::debug;
#[derive(Debug, Copy, Clone, HashStable_Generic)]
pub struct Lifetime {
@ -4008,8 +4014,9 @@ impl<'hir> Node<'hir> {
// 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!(Block<'_>, 48);
static_assert_size!(Body<'_>, 24);

View file

@ -1,8 +1,11 @@
use crate::def_id::{DefId, DefIndex, LocalDefId, CRATE_DEF_ID};
use std::fmt::{self, Debug};
use rustc_data_structures::stable_hasher::{HashStable, StableHasher, StableOrd, ToStableHashKey};
use rustc_macros::{Decodable, Encodable, HashStable_Generic};
use rustc_span::{def_id::DefPathHash, HashStableContext};
use std::fmt::{self, Debug};
use rustc_span::def_id::DefPathHash;
use rustc_span::HashStableContext;
use crate::def_id::{DefId, DefIndex, LocalDefId, CRATE_DEF_ID};
#[derive(Copy, Clone, PartialEq, Eq, Hash, Encodable, Decodable)]
pub struct OwnerId {

View file

@ -64,13 +64,14 @@
//! This order consistency is required in a few places in rustc, for
//! example coroutine inference, and possibly also HIR borrowck.
use crate::hir::*;
use rustc_ast::visit::{try_visit, visit_opt, walk_list, VisitorResult};
use rustc_ast::{Attribute, Label};
use rustc_span::def_id::LocalDefId;
use rustc_span::symbol::{Ident, Symbol};
use rustc_span::Span;
use crate::hir::*;
pub trait IntoVisitor<'hir> {
type Visitor: Visitor<'hir>;
fn into_visitor(&self) -> Self::Visitor;

View file

@ -7,9 +7,6 @@
//! * Traits that represent operators; e.g., `Add`, `Sub`, `Index`.
//! * Functions called by the compiler itself.
use crate::def_id::DefId;
use crate::{MethodKind, Target};
use rustc_ast as ast;
use rustc_data_structures::fx::FxIndexMap;
use rustc_data_structures::stable_hasher::{HashStable, StableHasher};
@ -17,6 +14,9 @@ use rustc_macros::{Decodable, Encodable, HashStable_Generic};
use rustc_span::symbol::{kw, sym, Symbol};
use rustc_span::Span;
use crate::def_id::DefId;
use crate::{MethodKind, Target};
/// All of the lang items, defined or not.
/// Defined lang items can come from the current crate or its dependencies.
#[derive(HashStable_Generic, Debug)]

View file

@ -1,10 +1,11 @@
use crate::def::{CtorOf, DefKind, Res};
use crate::def_id::{DefId, DefIdSet};
use crate::hir::{self, BindingMode, ByRef, HirId, PatKind};
use std::iter::Enumerate;
use rustc_span::symbol::Ident;
use rustc_span::Span;
use std::iter::Enumerate;
use crate::def::{CtorOf, DefKind, Res};
use crate::def_id::{DefId, DefIdSet};
use crate::hir::{self, BindingMode, ByRef, HirId, PatKind};
pub struct EnumerateAndAdjust<I> {
enumerate: Enumerate<I>,

View file

@ -1,10 +1,10 @@
use rustc_data_structures::stable_hasher::{HashStable, StableHasher, ToStableHashKey};
use rustc_span::def_id::DefPathHash;
use crate::hir::{
AttributeMap, BodyId, Crate, ForeignItemId, ImplItemId, ItemId, OwnerNodes, TraitItemId,
};
use crate::hir_id::{HirId, ItemLocalId};
use rustc_span::def_id::DefPathHash;
/// Requirements for a `StableHashingContext` to be used in this crate.
/// This is a hack to allow using the `HashStable_Generic` derive macro

View file

@ -4,11 +4,10 @@
//! conflicts between multiple such attributes attached to the same
//! item.
use crate::hir;
use crate::{Item, ItemKind, TraitItem, TraitItemKind};
use std::fmt::{self, Display};
use crate::def::DefKind;
use std::fmt::{self, Display};
use crate::{hir, Item, ItemKind, TraitItem, TraitItemKind};
#[derive(Copy, Clone, PartialEq, Debug)]
pub enum GenericParamKind {

View file

@ -1,9 +1,10 @@
use crate::definitions::{DefKey, DefPathData, DisambiguatedDefPathData};
use rustc_data_structures::stable_hasher::Hash64;
use rustc_span::def_id::{DefPathHash, StableCrateId};
use rustc_span::edition::Edition;
use rustc_span::{create_session_globals_then, Symbol};
use crate::definitions::{DefKey, DefPathData, DisambiguatedDefPathData};
#[test]
fn def_path_hash_depends_on_crate_id() {
// This test makes sure that *both* halves of a DefPathHash depend on

View file

@ -1,9 +1,9 @@
//! Validity checking for weak lang items
use crate::LangItem;
use rustc_span::symbol::{sym, Symbol};
use crate::LangItem;
macro_rules! weak_lang_items {
($($item:ident, $sym:ident;)*) => {
pub static WEAK_LANG_ITEMS: &[LangItem] = &[$(LangItem::$item,)*];