diff options
| author | ljedrz <ljedrz@gmail.com> | 2018-10-01 15:26:53 +0200 |
|---|---|---|
| committer | ljedrz <ljedrz@gmail.com> | 2018-10-05 08:58:05 +0200 |
| commit | 2ff117df5096c23b466992a0a3427edf1af3113d (patch) | |
| tree | 701273dc49b8bdb04448f7ed225759f268c026ca | |
| parent | b8bea5a0a6aef3966008787a25949344f8cf6942 (diff) | |
| download | rust-2ff117df5096c23b466992a0a3427edf1af3113d.tar.gz rust-2ff117df5096c23b466992a0a3427edf1af3113d.zip | |
rustc/ty: whitespace fixes
| -rw-r--r-- | src/librustc/ty/codec.rs | 28 | ||||
| -rw-r--r-- | src/librustc/ty/context.rs | 27 | ||||
| -rw-r--r-- | src/librustc/ty/query/config.rs | 4 | ||||
| -rw-r--r-- | src/librustc/ty/query/on_disk_cache.rs | 15 | ||||
| -rw-r--r-- | src/librustc/ty/query/plumbing.rs | 14 |
5 files changed, 42 insertions, 46 deletions
diff --git a/src/librustc/ty/codec.rs b/src/librustc/ty/codec.rs index ae87d30ec94..8738f574148 100644 --- a/src/librustc/ty/codec.rs +++ b/src/librustc/ty/codec.rs @@ -178,19 +178,19 @@ pub fn decode_predicates<'a, 'tcx, D>(decoder: &mut D) Ok(ty::GenericPredicates { parent: Decodable::decode(decoder)?, predicates: (0..decoder.read_usize()?).map(|_| { - // Handle shorthands first, if we have an usize > 0x80. - let predicate = if decoder.positioned_at_shorthand() { - let pos = decoder.read_usize()?; - assert!(pos >= SHORTHAND_OFFSET); - let shorthand = pos - SHORTHAND_OFFSET; - - decoder.with_position(shorthand, ty::Predicate::decode) - } else { - ty::Predicate::decode(decoder) - }?; - Ok((predicate, Decodable::decode(decoder)?)) - }) - .collect::<Result<Vec<_>, _>>()?, + // Handle shorthands first, if we have an usize > 0x80. + let predicate = if decoder.positioned_at_shorthand() { + let pos = decoder.read_usize()?; + assert!(pos >= SHORTHAND_OFFSET); + let shorthand = pos - SHORTHAND_OFFSET; + + decoder.with_position(shorthand, ty::Predicate::decode) + } else { + ty::Predicate::decode(decoder) + }?; + Ok((predicate, Decodable::decode(decoder)?)) + }) + .collect::<Result<Vec<_>, _>>()?, }) } @@ -267,7 +267,7 @@ pub fn decode_const<'a, 'tcx, D>(decoder: &mut D) #[inline] pub fn decode_allocation<'a, 'tcx, D>(decoder: &mut D) - -> Result<&'tcx Allocation, D::Error> + -> Result<&'tcx Allocation, D::Error> where D: TyDecoder<'a, 'tcx>, 'tcx: 'a, { diff --git a/src/librustc/ty/context.rs b/src/librustc/ty/context.rs index 05b68b34989..daada8891d7 100644 --- a/src/librustc/ty/context.rs +++ b/src/librustc/ty/context.rs @@ -190,8 +190,8 @@ impl<'gcx: 'tcx, 'tcx> CtxtInterners<'tcx> { // types/regions in the global interner if local as *const _ as usize == global as *const _ as usize { bug!("Attempted to intern `{:?}` which contains \ - inference types/regions in the global type context", - &ty_struct); + inference types/regions in the global type context", + &ty_struct); } // Don't be &mut TyS. @@ -272,9 +272,9 @@ fn validate_hir_id_for_typeck_tables(local_id_root: Option<DefId>, bug!("node {} with HirId::owner {:?} cannot be placed in \ TypeckTables with local_id_root {:?}", - tcx.hir.node_to_string(node_id), - DefId::local(hir_id.owner), - local_id_root) + tcx.hir.node_to_string(node_id), + DefId::local(hir_id.owner), + local_id_root) }); } } else { @@ -686,7 +686,7 @@ impl<'tcx> TypeckTables<'tcx> { } pub fn pat_adjustments_mut(&mut self) - -> LocalTableInContextMut<'_, Vec<Ty<'tcx>>> { + -> LocalTableInContextMut<'_, Vec<Ty<'tcx>>> { LocalTableInContextMut { local_id_root: self.local_id_root, data: &mut self.pat_adjustments, @@ -1199,8 +1199,8 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> { let hir_id = hir.node_to_hir_id(k); let map = trait_map.entry(hir_id.owner).or_default(); Lrc::get_mut(map).unwrap() - .insert(hir_id.local_id, - Lrc::new(StableVec::new(v))); + .insert(hir_id.local_id, + Lrc::new(StableVec::new(v))); } let gcx = &GlobalCtxt { @@ -2188,7 +2188,6 @@ macro_rules! sty_debug_print { }; $(let mut $variant = total;)* - for &Interned(t) in tcx.interners.type_.borrow().iter() { let variant = match t.sty { ty::Bool | ty::Char | ty::Int(..) | ty::Uint(..) | @@ -2207,7 +2206,7 @@ macro_rules! sty_debug_print { } println!("Ty interner total ty region both"); $(println!(" {:18}: {uses:6} {usespc:4.1}%, \ -{ty:4.1}% {region:5.1}% {both:4.1}%", + {ty:4.1}% {region:5.1}% {both:4.1}%", stringify!($variant), uses = $variant.total, usespc = $variant.total as f64 * 100.0 / total.total as f64, @@ -2216,7 +2215,7 @@ macro_rules! sty_debug_print { both = $variant.both_infer as f64 * 100.0 / total.total as f64); )* println!(" total {uses:6} \ -{ty:4.1}% {region:5.1}% {both:4.1}%", + {ty:4.1}% {region:5.1}% {both:4.1}%", uses = total.total, ty = total.ty_infer as f64 * 100.0 / total.total as f64, region = total.region_infer as f64 * 100.0 / total.total as f64, @@ -2653,7 +2652,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> { } pub fn mk_closure(self, closure_id: DefId, closure_substs: ClosureSubsts<'tcx>) - -> Ty<'tcx> { + -> Ty<'tcx> { self.mk_ty(Closure(closure_id, closure_substs)) } @@ -2686,8 +2685,8 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> { } pub fn mk_ty_param(self, - index: u32, - name: InternedString) -> Ty<'tcx> { + index: u32, + name: InternedString) -> Ty<'tcx> { self.mk_ty(Param(ParamTy { idx: index, name: name })) } diff --git a/src/librustc/ty/query/config.rs b/src/librustc/ty/query/config.rs index 66d7541633c..0e11d6e0eec 100644 --- a/src/librustc/ty/query/config.rs +++ b/src/librustc/ty/query/config.rs @@ -386,8 +386,8 @@ impl<'tcx> QueryDescription<'tcx> for queries::const_is_rvalue_promotable_to_sta #[inline] fn try_load_from_disk<'a>(tcx: TyCtxt<'a, 'tcx, 'tcx>, - id: SerializedDepNodeIndex) - -> Option<Self::Value> { + id: SerializedDepNodeIndex) + -> Option<Self::Value> { tcx.queries.on_disk_cache.try_load_query_result(tcx, id) } } diff --git a/src/librustc/ty/query/on_disk_cache.rs b/src/librustc/ty/query/on_disk_cache.rs index bb877864632..7d3ce7307dc 100644 --- a/src/librustc/ty/query/on_disk_cache.rs +++ b/src/librustc/ty/query/on_disk_cache.rs @@ -448,9 +448,9 @@ impl<'sess> OnDiskCache<'sess> { }).collect::<FxHashMap<_,_>>(); let map_size = prev_cnums.iter() - .map(|&(cnum, ..)| cnum) - .max() - .unwrap_or(0) + 1; + .map(|&(cnum, ..)| cnum) + .max() + .unwrap_or(0) + 1; let mut map = IndexVec::new(); map.resize(map_size as usize, None); @@ -465,7 +465,6 @@ impl<'sess> OnDiskCache<'sess> { } } - //- DECODING ------------------------------------------------------------------- /// 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> { file_index_to_file.borrow_mut().entry(index).or_insert_with(|| { let stable_id = file_index_to_stable_id[&index]; source_map.source_file_by_stable_id(stable_id) - .expect("Failed to lookup SourceFile in new context.") + .expect("Failed to lookup SourceFile in new context.") }).clone() } } @@ -761,7 +760,7 @@ for CacheDecoder<'a, 'tcx, 'x> { struct CacheEncoder<'enc, 'a, 'tcx, E> where E: 'enc + ty_codec::TyEncoder, - 'tcx: 'a, + 'tcx: 'a, { tcx: TyCtxt<'a, 'tcx, 'tcx>, encoder: &'enc mut E, @@ -839,9 +838,7 @@ impl<'enc, 'a, 'tcx, E> SpecializedEncoder<Span> for CacheEncoder<'enc, 'a, 'tcx let (file_lo, line_lo, col_lo) = match self.source_map .byte_pos_to_line_and_col(span_data.lo) { Some(pos) => pos, - None => { - return TAG_INVALID_SPAN.encode(self); - } + None => return TAG_INVALID_SPAN.encode(self) }; if !file_lo.contains(span_data.hi) { diff --git a/src/librustc/ty/query/plumbing.rs b/src/librustc/ty/query/plumbing.rs index fbd3a8f69bc..5f6fdbddf8f 100644 --- a/src/librustc/ty/query/plumbing.rs +++ b/src/librustc/ty/query/plumbing.rs @@ -449,14 +449,14 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> { let prev_dep_node_index = self.dep_graph.prev_dep_node_index_of(dep_node); let result = Q::try_load_from_disk(self.global_tcx(), - prev_dep_node_index); + prev_dep_node_index); // We always expect to find a cached result for things that // can be forced from DepNode. debug_assert!(!dep_node.kind.can_reconstruct_query_key() || - result.is_some(), - "Missing on-disk cache entry for {:?}", - dep_node); + result.is_some(), + "Missing on-disk cache entry for {:?}", + dep_node); result } else { // Some things are never cached on disk. @@ -491,7 +491,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> { assert!(Some(self.dep_graph.fingerprint_of(dep_node_index)) == self.dep_graph.prev_fingerprint_of(dep_node), "Fingerprint for green query instance not loaded \ - from cache: {:?}", dep_node); + from cache: {:?}", dep_node); debug!("BEGIN verify_ich({:?})", dep_node); let mut hcx = self.create_stable_hashing_context(); @@ -530,8 +530,8 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> { // (see for example #48923) assert!(!self.dep_graph.dep_node_exists(&dep_node), "Forcing query with already existing DepNode.\n\ - - query-key: {:?}\n\ - - dep-node: {:?}", + - query-key: {:?}\n\ + - dep-node: {:?}", key, dep_node); profq_msg!(self, ProfileQueriesMsg::ProviderBegin); |
