Skip to content

Commit 2ff117d

Browse files
committed
rustc/ty: whitespace fixes
1 parent b8bea5a commit 2ff117d

File tree

5 files changed

+42
-46
lines changed

5 files changed

+42
-46
lines changed

src/librustc/ty/codec.rs

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -178,19 +178,19 @@ pub fn decode_predicates<'a, 'tcx, D>(decoder: &mut D)
178178
Ok(ty::GenericPredicates {
179179
parent: Decodable::decode(decoder)?,
180180
predicates: (0..decoder.read_usize()?).map(|_| {
181-
// Handle shorthands first, if we have an usize > 0x80.
182-
let predicate = if decoder.positioned_at_shorthand() {
183-
let pos = decoder.read_usize()?;
184-
assert!(pos >= SHORTHAND_OFFSET);
185-
let shorthand = pos - SHORTHAND_OFFSET;
186-
187-
decoder.with_position(shorthand, ty::Predicate::decode)
188-
} else {
189-
ty::Predicate::decode(decoder)
190-
}?;
191-
Ok((predicate, Decodable::decode(decoder)?))
192-
})
193-
.collect::<Result<Vec<_>, _>>()?,
181+
// Handle shorthands first, if we have an usize > 0x80.
182+
let predicate = if decoder.positioned_at_shorthand() {
183+
let pos = decoder.read_usize()?;
184+
assert!(pos >= SHORTHAND_OFFSET);
185+
let shorthand = pos - SHORTHAND_OFFSET;
186+
187+
decoder.with_position(shorthand, ty::Predicate::decode)
188+
} else {
189+
ty::Predicate::decode(decoder)
190+
}?;
191+
Ok((predicate, Decodable::decode(decoder)?))
192+
})
193+
.collect::<Result<Vec<_>, _>>()?,
194194
})
195195
}
196196

@@ -267,7 +267,7 @@ pub fn decode_const<'a, 'tcx, D>(decoder: &mut D)
267267

268268
#[inline]
269269
pub fn decode_allocation<'a, 'tcx, D>(decoder: &mut D)
270-
-> Result<&'tcx Allocation, D::Error>
270+
-> Result<&'tcx Allocation, D::Error>
271271
where D: TyDecoder<'a, 'tcx>,
272272
'tcx: 'a,
273273
{

src/librustc/ty/context.rs

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -190,8 +190,8 @@ impl<'gcx: 'tcx, 'tcx> CtxtInterners<'tcx> {
190190
// types/regions in the global interner
191191
if local as *const _ as usize == global as *const _ as usize {
192192
bug!("Attempted to intern `{:?}` which contains \
193-
inference types/regions in the global type context",
194-
&ty_struct);
193+
inference types/regions in the global type context",
194+
&ty_struct);
195195
}
196196

197197
// Don't be &mut TyS.
@@ -272,9 +272,9 @@ fn validate_hir_id_for_typeck_tables(local_id_root: Option<DefId>,
272272

273273
bug!("node {} with HirId::owner {:?} cannot be placed in \
274274
TypeckTables with local_id_root {:?}",
275-
tcx.hir.node_to_string(node_id),
276-
DefId::local(hir_id.owner),
277-
local_id_root)
275+
tcx.hir.node_to_string(node_id),
276+
DefId::local(hir_id.owner),
277+
local_id_root)
278278
});
279279
}
280280
} else {
@@ -686,7 +686,7 @@ impl<'tcx> TypeckTables<'tcx> {
686686
}
687687

688688
pub fn pat_adjustments_mut(&mut self)
689-
-> LocalTableInContextMut<'_, Vec<Ty<'tcx>>> {
689+
-> LocalTableInContextMut<'_, Vec<Ty<'tcx>>> {
690690
LocalTableInContextMut {
691691
local_id_root: self.local_id_root,
692692
data: &mut self.pat_adjustments,
@@ -1199,8 +1199,8 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
11991199
let hir_id = hir.node_to_hir_id(k);
12001200
let map = trait_map.entry(hir_id.owner).or_default();
12011201
Lrc::get_mut(map).unwrap()
1202-
.insert(hir_id.local_id,
1203-
Lrc::new(StableVec::new(v)));
1202+
.insert(hir_id.local_id,
1203+
Lrc::new(StableVec::new(v)));
12041204
}
12051205

12061206
let gcx = &GlobalCtxt {
@@ -2188,7 +2188,6 @@ macro_rules! sty_debug_print {
21882188
};
21892189
$(let mut $variant = total;)*
21902190

2191-
21922191
for &Interned(t) in tcx.interners.type_.borrow().iter() {
21932192
let variant = match t.sty {
21942193
ty::Bool | ty::Char | ty::Int(..) | ty::Uint(..) |
@@ -2207,7 +2206,7 @@ macro_rules! sty_debug_print {
22072206
}
22082207
println!("Ty interner total ty region both");
22092208
$(println!(" {:18}: {uses:6} {usespc:4.1}%, \
2210-
{ty:4.1}% {region:5.1}% {both:4.1}%",
2209+
{ty:4.1}% {region:5.1}% {both:4.1}%",
22112210
stringify!($variant),
22122211
uses = $variant.total,
22132212
usespc = $variant.total as f64 * 100.0 / total.total as f64,
@@ -2216,7 +2215,7 @@ macro_rules! sty_debug_print {
22162215
both = $variant.both_infer as f64 * 100.0 / total.total as f64);
22172216
)*
22182217
println!(" total {uses:6} \
2219-
{ty:4.1}% {region:5.1}% {both:4.1}%",
2218+
{ty:4.1}% {region:5.1}% {both:4.1}%",
22202219
uses = total.total,
22212220
ty = total.ty_infer as f64 * 100.0 / total.total as f64,
22222221
region = total.region_infer as f64 * 100.0 / total.total as f64,
@@ -2653,7 +2652,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
26532652
}
26542653

26552654
pub fn mk_closure(self, closure_id: DefId, closure_substs: ClosureSubsts<'tcx>)
2656-
-> Ty<'tcx> {
2655+
-> Ty<'tcx> {
26572656
self.mk_ty(Closure(closure_id, closure_substs))
26582657
}
26592658

@@ -2686,8 +2685,8 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
26862685
}
26872686

26882687
pub fn mk_ty_param(self,
2689-
index: u32,
2690-
name: InternedString) -> Ty<'tcx> {
2688+
index: u32,
2689+
name: InternedString) -> Ty<'tcx> {
26912690
self.mk_ty(Param(ParamTy { idx: index, name: name }))
26922691
}
26932692

src/librustc/ty/query/config.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -386,8 +386,8 @@ impl<'tcx> QueryDescription<'tcx> for queries::const_is_rvalue_promotable_to_sta
386386

387387
#[inline]
388388
fn try_load_from_disk<'a>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
389-
id: SerializedDepNodeIndex)
390-
-> Option<Self::Value> {
389+
id: SerializedDepNodeIndex)
390+
-> Option<Self::Value> {
391391
tcx.queries.on_disk_cache.try_load_query_result(tcx, id)
392392
}
393393
}

src/librustc/ty/query/on_disk_cache.rs

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -448,9 +448,9 @@ impl<'sess> OnDiskCache<'sess> {
448448
}).collect::<FxHashMap<_,_>>();
449449

450450
let map_size = prev_cnums.iter()
451-
.map(|&(cnum, ..)| cnum)
452-
.max()
453-
.unwrap_or(0) + 1;
451+
.map(|&(cnum, ..)| cnum)
452+
.max()
453+
.unwrap_or(0) + 1;
454454
let mut map = IndexVec::new();
455455
map.resize(map_size as usize, None);
456456

@@ -465,7 +465,6 @@ impl<'sess> OnDiskCache<'sess> {
465465
}
466466
}
467467

468-
469468
//- DECODING -------------------------------------------------------------------
470469

471470
/// A decoder that can read the incr. comp. cache. It is similar to the one
@@ -494,7 +493,7 @@ impl<'a, 'tcx, 'x> CacheDecoder<'a, 'tcx, 'x> {
494493
file_index_to_file.borrow_mut().entry(index).or_insert_with(|| {
495494
let stable_id = file_index_to_stable_id[&index];
496495
source_map.source_file_by_stable_id(stable_id)
497-
.expect("Failed to lookup SourceFile in new context.")
496+
.expect("Failed to lookup SourceFile in new context.")
498497
}).clone()
499498
}
500499
}
@@ -761,7 +760,7 @@ for CacheDecoder<'a, 'tcx, 'x> {
761760

762761
struct CacheEncoder<'enc, 'a, 'tcx, E>
763762
where E: 'enc + ty_codec::TyEncoder,
764-
'tcx: 'a,
763+
'tcx: 'a,
765764
{
766765
tcx: TyCtxt<'a, 'tcx, 'tcx>,
767766
encoder: &'enc mut E,
@@ -839,9 +838,7 @@ impl<'enc, 'a, 'tcx, E> SpecializedEncoder<Span> for CacheEncoder<'enc, 'a, 'tcx
839838
let (file_lo, line_lo, col_lo) = match self.source_map
840839
.byte_pos_to_line_and_col(span_data.lo) {
841840
Some(pos) => pos,
842-
None => {
843-
return TAG_INVALID_SPAN.encode(self);
844-
}
841+
None => return TAG_INVALID_SPAN.encode(self)
845842
};
846843

847844
if !file_lo.contains(span_data.hi) {

src/librustc/ty/query/plumbing.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -449,14 +449,14 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
449449
let prev_dep_node_index =
450450
self.dep_graph.prev_dep_node_index_of(dep_node);
451451
let result = Q::try_load_from_disk(self.global_tcx(),
452-
prev_dep_node_index);
452+
prev_dep_node_index);
453453

454454
// We always expect to find a cached result for things that
455455
// can be forced from DepNode.
456456
debug_assert!(!dep_node.kind.can_reconstruct_query_key() ||
457-
result.is_some(),
458-
"Missing on-disk cache entry for {:?}",
459-
dep_node);
457+
result.is_some(),
458+
"Missing on-disk cache entry for {:?}",
459+
dep_node);
460460
result
461461
} else {
462462
// Some things are never cached on disk.
@@ -491,7 +491,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
491491
assert!(Some(self.dep_graph.fingerprint_of(dep_node_index)) ==
492492
self.dep_graph.prev_fingerprint_of(dep_node),
493493
"Fingerprint for green query instance not loaded \
494-
from cache: {:?}", dep_node);
494+
from cache: {:?}", dep_node);
495495

496496
debug!("BEGIN verify_ich({:?})", dep_node);
497497
let mut hcx = self.create_stable_hashing_context();
@@ -530,8 +530,8 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
530530
// (see for example #48923)
531531
assert!(!self.dep_graph.dep_node_exists(&dep_node),
532532
"Forcing query with already existing DepNode.\n\
533-
- query-key: {:?}\n\
534-
- dep-node: {:?}",
533+
- query-key: {:?}\n\
534+
- dep-node: {:?}",
535535
key, dep_node);
536536

537537
profq_msg!(self, ProfileQueriesMsg::ProviderBegin);

0 commit comments

Comments
 (0)