Skip to content

Commit fff08cb

Browse files
committed
Run rustfmt --file-lines ... for changes from previous commits.
1 parent 21ac960 commit fff08cb

File tree

176 files changed

+2212
-2132
lines changed

Some content is hidden

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

176 files changed

+2212
-2132
lines changed

src/librustc/cfg/construct.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,7 @@ struct LoopScope {
3030
break_index: CFGIndex, // where to go on a `break`
3131
}
3232

33-
pub fn construct<'tcx>(tcx: TyCtxt<'tcx, 'tcx>,
34-
body: &hir::Body) -> CFG {
33+
pub fn construct<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, body: &hir::Body) -> CFG {
3534
let mut graph = graph::Graph::new();
3635
let entry = graph.add_node(CFGNodeData::Entry);
3736

src/librustc/cfg/mod.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,7 @@ pub type CFGNode = graph::Node<CFGNodeData>;
4949
pub type CFGEdge = graph::Edge<CFGEdgeData>;
5050

5151
impl CFG {
52-
pub fn new<'tcx>(tcx: TyCtxt<'tcx, 'tcx>,
53-
body: &hir::Body) -> CFG {
52+
pub fn new<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, body: &hir::Body) -> CFG {
5453
construct::construct(tcx, body)
5554
}
5655

src/librustc/dep_graph/dep_node.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -480,7 +480,8 @@ trait DepNodeParams<'gcx: 'tcx, 'tcx>: fmt::Debug {
480480
}
481481

482482
impl<'gcx: 'tcx, 'tcx, T> DepNodeParams<'gcx, 'tcx> for T
483-
where T: HashStable<StableHashingContext<'tcx>> + fmt::Debug
483+
where
484+
T: HashStable<StableHashingContext<'tcx>> + fmt::Debug,
484485
{
485486
default const CAN_RECONSTRUCT_QUERY_KEY: bool = false;
486487

src/librustc/dep_graph/graph.rs

+3-4
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,6 @@ where
9090
}
9191

9292
impl DepGraph {
93-
9493
pub fn new(prev_graph: PreviousDepGraph,
9594
prev_work_products: FxHashMap<WorkProductId, WorkProduct>) -> DepGraph {
9695
let prev_graph_node_count = prev_graph.node_count();
@@ -559,7 +558,7 @@ impl DepGraph {
559558
pub fn try_mark_green_and_read(
560559
&self,
561560
tcx: TyCtxt<'_, '_>,
562-
dep_node: &DepNode
561+
dep_node: &DepNode,
563562
) -> Option<(SerializedDepNodeIndex, DepNodeIndex)> {
564563
self.try_mark_green(tcx, dep_node).map(|(prev_index, dep_node_index)| {
565564
debug_assert!(self.is_green(&dep_node));
@@ -571,7 +570,7 @@ impl DepGraph {
571570
pub fn try_mark_green(
572571
&self,
573572
tcx: TyCtxt<'_, '_>,
574-
dep_node: &DepNode
573+
dep_node: &DepNode,
575574
) -> Option<(SerializedDepNodeIndex, DepNodeIndex)> {
576575
debug_assert!(!dep_node.kind.is_eval_always());
577576

@@ -607,7 +606,7 @@ impl DepGraph {
607606
tcx: TyCtxt<'tcx, 'tcx>,
608607
data: &DepGraphData,
609608
prev_dep_node_index: SerializedDepNodeIndex,
610-
dep_node: &DepNode
609+
dep_node: &DepNode,
611610
) -> Option<DepNodeIndex> {
612611
debug!("try_mark_previous_green({:?}) - BEGIN", dep_node);
613612

src/librustc/dep_graph/safe.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,7 @@ impl DepGraphSafe for DefId {
3333

3434
/// The type context itself can be used to access all kinds of tracked
3535
/// state, but those accesses should always generate read events.
36-
impl<'gcx, 'tcx> DepGraphSafe for TyCtxt<'gcx, 'tcx> {
37-
}
36+
impl<'gcx, 'tcx> DepGraphSafe for TyCtxt<'gcx, 'tcx> {}
3837

3938
/// Tuples make it easy to build up state.
4039
impl<A, B> DepGraphSafe for (A, B)

src/librustc/infer/canonical/substitute.rs

+1-5
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,7 @@ use crate::ty::{self, TyCtxt};
1414
impl<'tcx, V> Canonical<'tcx, V> {
1515
/// Instantiate the wrapped value, replacing each canonical value
1616
/// with the value given in `var_values`.
17-
pub fn substitute(
18-
&self,
19-
tcx: TyCtxt<'_, 'tcx>,
20-
var_values: &CanonicalVarValues<'tcx>,
21-
) -> V
17+
pub fn substitute(&self, tcx: TyCtxt<'_, 'tcx>, var_values: &CanonicalVarValues<'tcx>) -> V
2218
where
2319
V: TypeFoldable<'tcx>,
2420
{

src/librustc/infer/combine.rs

+8-6
Original file line numberDiff line numberDiff line change
@@ -58,12 +58,14 @@ pub enum RelationDir {
5858
}
5959

6060
impl<'infcx, 'gcx, 'tcx> InferCtxt<'infcx, 'gcx, 'tcx> {
61-
pub fn super_combine_tys<R>(&self,
62-
relation: &mut R,
63-
a: Ty<'tcx>,
64-
b: Ty<'tcx>)
65-
-> RelateResult<'tcx, Ty<'tcx>>
66-
where R: TypeRelation<'gcx, 'tcx>
61+
pub fn super_combine_tys<R>(
62+
&self,
63+
relation: &mut R,
64+
a: Ty<'tcx>,
65+
b: Ty<'tcx>,
66+
) -> RelateResult<'tcx, Ty<'tcx>>
67+
where
68+
R: TypeRelation<'gcx, 'tcx>,
6769
{
6870
let a_is_expected = relation.a_is_expected();
6971

src/librustc/infer/error_reporting/nice_region_error/placeholder_error.rs

+4-1
Original file line numberDiff line numberDiff line change
@@ -338,7 +338,10 @@ impl NiceRegionError<'me, 'gcx, 'tcx> {
338338
}
339339

340340
impl<'gcx, 'tcx, T> fmt::Display for Highlighted<'gcx, 'tcx, T>
341-
where T: for<'a, 'b, 'c> Print<'gcx, 'tcx,
341+
where
342+
T: for<'a, 'b, 'c> Print<
343+
'gcx,
344+
'tcx,
342345
FmtPrinter<'a, 'gcx, 'tcx, &'b mut fmt::Formatter<'c>>,
343346
Error = fmt::Error,
344347
>,

src/librustc/infer/lattice.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ use crate::ty::TyVar;
2727
use crate::ty::{self, Ty};
2828
use crate::ty::relate::{RelateResult, TypeRelation};
2929

30-
pub trait LatticeDir<'f, 'gcx: 'f+'tcx, 'tcx: 'f> : TypeRelation<'gcx, 'tcx> {
30+
pub trait LatticeDir<'f, 'gcx: 'f + 'tcx, 'tcx: 'f>: TypeRelation<'gcx, 'tcx> {
3131
fn infcx(&self) -> &'f InferCtxt<'f, 'gcx, 'tcx>;
3232

3333
fn cause(&self) -> &ObligationCause<'tcx>;

src/librustc/infer/outlives/free_region_map.rs

+6-5
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,12 @@ impl<'tcx> FreeRegionMap<'tcx> {
2828
/// cases, this is more conservative than necessary, in order to
2929
/// avoid making arbitrary choices. See
3030
/// `TransitiveRelation::postdom_upper_bound` for more details.
31-
pub fn lub_free_regions<'gcx>(&self,
32-
tcx: TyCtxt<'gcx, 'tcx>,
33-
r_a: Region<'tcx>,
34-
r_b: Region<'tcx>)
35-
-> Region<'tcx> {
31+
pub fn lub_free_regions<'gcx>(
32+
&self,
33+
tcx: TyCtxt<'gcx, 'tcx>,
34+
r_a: Region<'tcx>,
35+
r_b: Region<'tcx>,
36+
) -> Region<'tcx> {
3637
debug!("lub_free_regions(r_a={:?}, r_b={:?})", r_a, r_b);
3738
assert!(is_free(r_a));
3839
assert!(is_free(r_b));

src/librustc/lint/context.rs

+2-5
Original file line numberDiff line numberDiff line change
@@ -1423,10 +1423,7 @@ pub fn late_lint_mod<'tcx, T: for<'a> LateLintPass<'a, 'tcx>>(
14231423
}
14241424
}
14251425

1426-
fn late_lint_pass_crate<'tcx, T: for<'a> LateLintPass<'a, 'tcx>>(
1427-
tcx: TyCtxt<'tcx, 'tcx>,
1428-
pass: T
1429-
) {
1426+
fn late_lint_pass_crate<'tcx, T: for<'a> LateLintPass<'a, 'tcx>>(tcx: TyCtxt<'tcx, 'tcx>, pass: T) {
14301427
let access_levels = &tcx.privacy_access_levels(LOCAL_CRATE);
14311428

14321429
let krate = tcx.hir().krate();
@@ -1461,7 +1458,7 @@ fn late_lint_pass_crate<'tcx, T: for<'a> LateLintPass<'a, 'tcx>>(
14611458

14621459
fn late_lint_crate<'tcx, T: for<'a> LateLintPass<'a, 'tcx>>(
14631460
tcx: TyCtxt<'tcx, 'tcx>,
1464-
builtin_lints: T
1461+
builtin_lints: T,
14651462
) {
14661463
let mut passes = tcx.sess.lint_store.borrow().late_passes.lock().take().unwrap();
14671464

src/librustc/lint/mod.rs

+1-3
Original file line numberDiff line numberDiff line change
@@ -766,9 +766,7 @@ pub fn maybe_lint_level_root(tcx: TyCtxt<'_, '_>, id: hir::HirId) -> bool {
766766
attrs.iter().any(|attr| Level::from_symbol(attr.name_or_empty()).is_some())
767767
}
768768

769-
fn lint_levels<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, cnum: CrateNum)
770-
-> &'tcx LintLevelMap
771-
{
769+
fn lint_levels<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, cnum: CrateNum) -> &'tcx LintLevelMap {
772770
assert_eq!(cnum, LOCAL_CRATE);
773771
let mut builder = LintLevelMapBuilder {
774772
levels: LintLevelSets::builder(tcx.sess),

src/librustc/middle/cstore.rs

+2-6
Original file line numberDiff line numberDiff line change
@@ -211,9 +211,7 @@ pub trait CrateStore {
211211
fn crates_untracked(&self) -> Vec<CrateNum>;
212212

213213
// utility functions
214-
fn encode_metadata<'tcx>(&self,
215-
tcx: TyCtxt<'tcx, 'tcx>)
216-
-> EncodedMetadata;
214+
fn encode_metadata<'tcx>(&self, tcx: TyCtxt<'tcx, 'tcx>) -> EncodedMetadata;
217215
fn metadata_encoding_version(&self) -> &[u8];
218216
}
219217

@@ -228,9 +226,7 @@ pub type CrateStoreDyn = dyn CrateStore + sync::Sync;
228226
// In order to get this left-to-right dependency ordering, we perform a
229227
// topological sort of all crates putting the leaves at the right-most
230228
// positions.
231-
pub fn used_crates(tcx: TyCtxt<'_, '_>, prefer: LinkagePreference)
232-
-> Vec<(CrateNum, LibSource)>
233-
{
229+
pub fn used_crates(tcx: TyCtxt<'_, '_>, prefer: LinkagePreference) -> Vec<(CrateNum, LibSource)> {
234230
let mut libs = tcx.crates()
235231
.iter()
236232
.cloned()

src/librustc/middle/dead.rs

+11-9
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,7 @@ use syntax_pos;
2626
// explored. For example, if it's a live Node::Item that is a
2727
// function, then we should explore its block to check for codes that
2828
// may need to be marked as live.
29-
fn should_explore<'tcx>(tcx: TyCtxt<'tcx, 'tcx>,
30-
hir_id: hir::HirId) -> bool {
29+
fn should_explore<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, hir_id: hir::HirId) -> bool {
3130
match tcx.hir().find_by_hir_id(hir_id) {
3231
Some(Node::Item(..)) |
3332
Some(Node::ImplItem(..)) |
@@ -302,9 +301,11 @@ impl<'a, 'tcx> Visitor<'tcx> for MarkSymbolVisitor<'a, 'tcx> {
302301
}
303302
}
304303

305-
fn has_allow_dead_code_or_lang_attr(tcx: TyCtxt<'_, '_>,
306-
id: hir::HirId,
307-
attrs: &[ast::Attribute]) -> bool {
304+
fn has_allow_dead_code_or_lang_attr(
305+
tcx: TyCtxt<'_, '_>,
306+
id: hir::HirId,
307+
attrs: &[ast::Attribute],
308+
) -> bool {
308309
if attr::contains_name(attrs, sym::lang) {
309310
return true;
310311
}
@@ -451,10 +452,11 @@ fn create_and_seed_worklist<'tcx>(
451452
(life_seeder.worklist, life_seeder.struct_constructors)
452453
}
453454

454-
fn find_live<'tcx>(tcx: TyCtxt<'tcx, 'tcx>,
455-
access_levels: &privacy::AccessLevels,
456-
krate: &hir::Crate)
457-
-> FxHashSet<hir::HirId> {
455+
fn find_live<'tcx>(
456+
tcx: TyCtxt<'tcx, 'tcx>,
457+
access_levels: &privacy::AccessLevels,
458+
krate: &hir::Crate,
459+
) -> FxHashSet<hir::HirId> {
458460
let (worklist, struct_constructors) = create_and_seed_worklist(tcx, access_levels, krate);
459461
let mut symbol_visitor = MarkSymbolVisitor {
460462
worklist,

src/librustc/middle/dependency_format.rs

+7-7
Original file line numberDiff line numberDiff line change
@@ -92,9 +92,7 @@ pub fn calculate<'tcx>(tcx: TyCtxt<'tcx, 'tcx>) {
9292
sess.dependency_formats.set(fmts);
9393
}
9494

95-
fn calculate_type<'tcx>(tcx: TyCtxt<'tcx, 'tcx>,
96-
ty: config::CrateType) -> DependencyList {
97-
95+
fn calculate_type<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, ty: config::CrateType) -> DependencyList {
9896
let sess = &tcx.sess;
9997

10098
if !sess.opts.output_types.should_codegen() {
@@ -242,10 +240,12 @@ fn calculate_type<'tcx>(tcx: TyCtxt<'tcx, 'tcx>,
242240
ret
243241
}
244242

245-
fn add_library(tcx: TyCtxt<'_, '_>,
246-
cnum: CrateNum,
247-
link: LinkagePreference,
248-
m: &mut FxHashMap<CrateNum, LinkagePreference>) {
243+
fn add_library(
244+
tcx: TyCtxt<'_, '_>,
245+
cnum: CrateNum,
246+
link: LinkagePreference,
247+
m: &mut FxHashMap<CrateNum, LinkagePreference>,
248+
) {
249249
match m.get(&cnum) {
250250
Some(&link2) => {
251251
// If the linkages differ, then we'd have two copies of the library

src/librustc/middle/exported_symbols.rs

+6-7
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,7 @@ pub enum ExportedSymbol<'tcx> {
3838
}
3939

4040
impl<'tcx> ExportedSymbol<'tcx> {
41-
pub fn symbol_name(&self,
42-
tcx: TyCtxt<'tcx, '_>)
43-
-> ty::SymbolName {
41+
pub fn symbol_name(&self, tcx: TyCtxt<'tcx, '_>) -> ty::SymbolName {
4442
match *self {
4543
ExportedSymbol::NonGeneric(def_id) => {
4644
tcx.symbol_name(ty::Instance::mono(tcx, def_id))
@@ -54,10 +52,11 @@ impl<'tcx> ExportedSymbol<'tcx> {
5452
}
5553
}
5654

57-
pub fn compare_stable(&self,
58-
tcx: TyCtxt<'tcx, '_>,
59-
other: &ExportedSymbol<'tcx>)
60-
-> cmp::Ordering {
55+
pub fn compare_stable(
56+
&self,
57+
tcx: TyCtxt<'tcx, '_>,
58+
other: &ExportedSymbol<'tcx>,
59+
) -> cmp::Ordering {
6160
match *self {
6261
ExportedSymbol::NonGeneric(self_def_id) => match *other {
6362
ExportedSymbol::NonGeneric(other_def_id) => {

src/librustc/middle/expr_use_visitor.rs

+9-9
Original file line numberDiff line numberDiff line change
@@ -266,15 +266,15 @@ impl<'a, 'tcx> ExprUseVisitor<'a, 'tcx, 'tcx> {
266266
/// `None` means that rvalues will be given more conservative lifetimes.
267267
///
268268
/// See also `with_infer`, which is used *during* typeck.
269-
pub fn new(delegate: &'a mut (dyn Delegate<'tcx>+'a),
270-
tcx: TyCtxt<'tcx, 'tcx>,
271-
body_owner: DefId,
272-
param_env: ty::ParamEnv<'tcx>,
273-
region_scope_tree: &'a region::ScopeTree,
274-
tables: &'a ty::TypeckTables<'tcx>,
275-
rvalue_promotable_map: Option<&'tcx ItemLocalSet>)
276-
-> Self
277-
{
269+
pub fn new(
270+
delegate: &'a mut (dyn Delegate<'tcx> + 'a),
271+
tcx: TyCtxt<'tcx, 'tcx>,
272+
body_owner: DefId,
273+
param_env: ty::ParamEnv<'tcx>,
274+
region_scope_tree: &'a region::ScopeTree,
275+
tables: &'a ty::TypeckTables<'tcx>,
276+
rvalue_promotable_map: Option<&'tcx ItemLocalSet>,
277+
) -> Self {
278278
ExprUseVisitor {
279279
mc: mc::MemCategorizationContext::new(tcx,
280280
body_owner,

src/librustc/middle/intrinsicck.rs

+2-4
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ pub fn provide(providers: &mut Providers<'_>) {
2525
}
2626

2727
struct ItemVisitor<'tcx> {
28-
tcx: TyCtxt<'tcx, 'tcx>
28+
tcx: TyCtxt<'tcx, 'tcx>,
2929
}
3030

3131
struct ExprVisitor<'tcx> {
@@ -36,9 +36,7 @@ struct ExprVisitor<'tcx> {
3636

3737
/// If the type is `Option<T>`, it will return `T`, otherwise
3838
/// the type itself. Works on most `Option`-like types.
39-
fn unpack_option_like<'tcx>(tcx: TyCtxt<'tcx, 'tcx>,
40-
ty: Ty<'tcx>)
41-
-> Ty<'tcx> {
39+
fn unpack_option_like<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, ty: Ty<'tcx>) -> Ty<'tcx> {
4240
let (def, substs) = match ty.sty {
4341
ty::Adt(def, substs) => (def, substs),
4442
_ => return ty

src/librustc/middle/liveness.rs

+8-6
Original file line numberDiff line numberDiff line change
@@ -352,12 +352,14 @@ impl IrMaps<'tcx> {
352352
}
353353
}
354354

355-
fn visit_fn<'a, 'tcx: 'a>(ir: &mut IrMaps<'tcx>,
356-
fk: FnKind<'tcx>,
357-
decl: &'tcx hir::FnDecl,
358-
body_id: hir::BodyId,
359-
sp: Span,
360-
id: hir::HirId) {
355+
fn visit_fn<'a, 'tcx: 'a>(
356+
ir: &mut IrMaps<'tcx>,
357+
fk: FnKind<'tcx>,
358+
decl: &'tcx hir::FnDecl,
359+
body_id: hir::BodyId,
360+
sp: Span,
361+
id: hir::HirId,
362+
) {
361363
debug!("visit_fn");
362364

363365
// swap in a new set of IR maps for this function body:

0 commit comments

Comments
 (0)