Skip to content

Commit 187bcb9

Browse files
committed
rustc/ty: whitespace fixes
1 parent 4cf1176 commit 187bcb9

File tree

11 files changed

+75
-76
lines changed

11 files changed

+75
-76
lines changed

src/librustc/ty/instance.rs

+16-15
Original file line numberDiff line numberDiff line change
@@ -229,11 +229,11 @@ impl<'a, 'b, 'tcx> Instance<'tcx> {
229229
}
230230

231231
pub fn resolve_closure(
232-
tcx: TyCtxt<'a, 'tcx, 'tcx>,
233-
def_id: DefId,
234-
substs: ty::ClosureSubsts<'tcx>,
235-
requested_kind: ty::ClosureKind)
236-
-> Instance<'tcx>
232+
tcx: TyCtxt<'a, 'tcx, 'tcx>,
233+
def_id: DefId,
234+
substs: ty::ClosureSubsts<'tcx>,
235+
requested_kind: ty::ClosureKind)
236+
-> Instance<'tcx>
237237
{
238238
let actual_kind = substs.closure_kind(def_id, tcx);
239239

@@ -253,8 +253,8 @@ fn resolve_associated_item<'a, 'tcx>(
253253
) -> Option<Instance<'tcx>> {
254254
let def_id = trait_item.def_id;
255255
debug!("resolve_associated_item(trait_item={:?}, \
256-
trait_id={:?}, \
257-
rcvr_substs={:?})",
256+
trait_id={:?}, \
257+
rcvr_substs={:?})",
258258
def_id, trait_id, rcvr_substs);
259259

260260
let trait_ref = ty::TraitRef::from_method(tcx, trait_id, rcvr_substs);
@@ -278,7 +278,7 @@ fn resolve_associated_item<'a, 'tcx>(
278278
traits::VtableClosure(closure_data) => {
279279
let trait_closure_kind = tcx.lang_items().fn_trait_kind(trait_id).unwrap();
280280
Some(Instance::resolve_closure(tcx, closure_data.closure_def_id, closure_data.substs,
281-
trait_closure_kind))
281+
trait_closure_kind))
282282
}
283283
traits::VtableFnPointer(ref data) => {
284284
Some(Instance {
@@ -308,7 +308,7 @@ fn resolve_associated_item<'a, 'tcx>(
308308
}
309309

310310
fn needs_fn_once_adapter_shim<'a, 'tcx>(actual_closure_kind: ty::ClosureKind,
311-
trait_closure_kind: ty::ClosureKind)
311+
trait_closure_kind: ty::ClosureKind)
312312
-> Result<bool, ()>
313313
{
314314
match (actual_closure_kind, trait_closure_kind) {
@@ -342,13 +342,14 @@ fn needs_fn_once_adapter_shim<'a, 'tcx>(actual_closure_kind: ty::ClosureKind,
342342
}
343343

344344
fn fn_once_adapter_instance<'a, 'tcx>(
345-
tcx: TyCtxt<'a, 'tcx, 'tcx>,
346-
closure_did: DefId,
347-
substs: ty::ClosureSubsts<'tcx>,
348-
) -> Instance<'tcx> {
345+
tcx: TyCtxt<'a, 'tcx, 'tcx>,
346+
closure_did: DefId,
347+
substs: ty::ClosureSubsts<'tcx>)
348+
-> Instance<'tcx>
349+
{
349350
debug!("fn_once_adapter_shim({:?}, {:?})",
350-
closure_did,
351-
substs);
351+
closure_did,
352+
substs);
352353
let fn_once = tcx.lang_items().fn_once_trait().unwrap();
353354
let call_once = tcx.associated_items(fn_once)
354355
.find(|it| it.kind == ty::AssociatedKind::Method)

src/librustc/ty/item_path.rs

+2-4
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
221221

222222
let data = cur_def_key.disambiguated_data.data;
223223
let symbol = data.get_opt_name().map(|n| n.as_str()).unwrap_or_else(|| {
224-
if let DefPathData::CrateRoot = data { // reexported `extern crate` (#43189)
224+
if let DefPathData::CrateRoot = data { // reexported `extern crate` (#43189)
225225
self.original_crate_name(cur_def.krate).as_str()
226226
} else {
227227
Symbol::intern("<unnamed>").as_str()
@@ -365,9 +365,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
365365

366366
if let Some(trait_ref) = impl_trait_ref {
367367
// Trait impls.
368-
buffer.push(&format!("<{} as {}>",
369-
self_ty,
370-
trait_ref));
368+
buffer.push(&format!("<{} as {}>", self_ty, trait_ref));
371369
return;
372370
}
373371

src/librustc/ty/layout.rs

+20-19
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,11 @@ pub trait IntegerExt {
3232
fn to_ty<'a, 'tcx>(&self, tcx: TyCtxt<'a, 'tcx, 'tcx>, signed: bool) -> Ty<'tcx>;
3333
fn from_attr<C: HasDataLayout>(cx: C, ity: attr::IntType) -> Integer;
3434
fn repr_discr<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
35-
ty: Ty<'tcx>,
36-
repr: &ReprOptions,
37-
min: i128,
38-
max: i128)
39-
-> (Integer, bool);
35+
ty: Ty<'tcx>,
36+
repr: &ReprOptions,
37+
min: i128,
38+
max: i128)
39+
-> (Integer, bool);
4040
}
4141

4242
impl IntegerExt for Integer {
@@ -76,11 +76,11 @@ impl IntegerExt for Integer {
7676
/// N.B.: u128 values above i128::MAX will be treated as signed, but
7777
/// that shouldn't affect anything, other than maybe debuginfo.
7878
fn repr_discr<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
79-
ty: Ty<'tcx>,
80-
repr: &ReprOptions,
81-
min: i128,
82-
max: i128)
83-
-> (Integer, bool) {
79+
ty: Ty<'tcx>,
80+
repr: &ReprOptions,
81+
min: i128,
82+
max: i128)
83+
-> (Integer, bool) {
8484
// Theoretically, negative values could be larger in unsigned representation
8585
// than the unsigned representation of the signed minimum. However, if there
8686
// are any negative values, the only valid unsigned representation is u128
@@ -96,7 +96,7 @@ impl IntegerExt for Integer {
9696
let fit = if ity.is_signed() { signed_fit } else { unsigned_fit };
9797
if discr < fit {
9898
bug!("Integer::repr_discr: `#[repr]` hint too small for \
99-
discriminant range of enum `{}", ty)
99+
discriminant range of enum `{}", ty)
100100
}
101101
return (discr, ity.is_signed());
102102
}
@@ -106,7 +106,7 @@ impl IntegerExt for Integer {
106106
// WARNING: the ARM EABI has two variants; the one corresponding
107107
// to `at_least == I32` appears to be used on Linux and NetBSD,
108108
// but some systems may use the variant corresponding to no
109-
// lower bound. However, we don't run on those yet...?
109+
// lower bound. However, we don't run on those yet...?
110110
"arm" => min_from_extern = Some(I32),
111111
_ => min_from_extern = Some(I32),
112112
}
@@ -250,6 +250,7 @@ impl<'a, 'tcx> LayoutCx<'tcx, TyCtxt<'a, 'tcx, 'tcx>> {
250250
/// A univariant, but with a prefix of an arbitrary size & alignment (e.g. enum tag).
251251
Prefixed(Size, Align),
252252
}
253+
253254
let univariant_uninterned = |fields: &[TyLayout<'_>], repr: &ReprOptions, kind| {
254255
let packed = repr.packed();
255256
if packed && repr.align > 0 {
@@ -324,7 +325,7 @@ impl<'a, 'tcx> LayoutCx<'tcx, TyCtxt<'a, 'tcx, 'tcx>> {
324325
let field = fields[i as usize];
325326
if !sized {
326327
bug!("univariant: field #{} of `{}` comes after unsized field",
327-
offsets.len(), ty);
328+
offsets.len(), ty);
328329
}
329330

330331
if field.is_unsized() {
@@ -628,7 +629,7 @@ impl<'a, 'tcx> LayoutCx<'tcx, TyCtxt<'a, 'tcx, 'tcx>> {
628629
};
629630

630631
univariant(&tys.iter().map(|ty| self.layout_of(ty)).collect::<Result<Vec<_>, _>>()?,
631-
&ReprOptions::default(), kind)?
632+
&ReprOptions::default(), kind)?
632633
}
633634

634635
// SIMD vector types.
@@ -640,7 +641,7 @@ impl<'a, 'tcx> LayoutCx<'tcx, TyCtxt<'a, 'tcx, 'tcx>> {
640641
Abi::Scalar(ref scalar) => scalar.clone(),
641642
_ => {
642643
tcx.sess.fatal(&format!("monomorphising SIMD type `{}` with \
643-
a non-machine element type `{}`",
644+
a non-machine element type `{}`",
644645
ty, element.ty));
645646
}
646647
};
@@ -743,7 +744,7 @@ impl<'a, 'tcx> LayoutCx<'tcx, TyCtxt<'a, 'tcx, 'tcx>> {
743744
// Only one variant is present.
744745
(present_second.is_none() &&
745746
// Representation optimizations are allowed.
746-
!def.repr.inhibit_enum_layout_opt());
747+
!def.repr.inhibit_enum_layout_opt());
747748
if is_struct {
748749
// Struct, or univariant enum equivalent to a struct.
749750
// (Typechecking will reject discriminant-sizing attrs.)
@@ -755,7 +756,7 @@ impl<'a, 'tcx> LayoutCx<'tcx, TyCtxt<'a, 'tcx, 'tcx>> {
755756
let param_env = tcx.param_env(def.did);
756757
let last_field = def.variants[v].fields.last().unwrap();
757758
let always_sized = tcx.type_of(last_field.did)
758-
.is_sized(tcx.at(DUMMY_SP), param_env);
759+
.is_sized(tcx.at(DUMMY_SP), param_env);
759760
if !always_sized { StructKind::MaybeUnsized }
760761
else { StructKind::AlwaysSized }
761762
};
@@ -1258,8 +1259,8 @@ impl<'a, 'tcx> LayoutCx<'tcx, TyCtxt<'a, 'tcx, 'tcx>> {
12581259
let fields: Vec<_> =
12591260
variant_def.fields.iter().map(|f| f.ident.name).collect();
12601261
build_variant_info(Some(variant_def.name),
1261-
&fields,
1262-
layout.for_variant(self, i))
1262+
&fields,
1263+
layout.for_variant(self, i))
12631264
})
12641265
.collect();
12651266
record(adt_kind.into(), adt_packed, match layout.variants {

src/librustc/ty/mod.rs

+9-11
Original file line numberDiff line numberDiff line change
@@ -956,7 +956,7 @@ impl<'a, 'gcx, 'tcx> Generics {
956956
}
957957
} else {
958958
tcx.generics_of(self.parent.expect("parent_count>0 but no parent?"))
959-
.region_param(param, tcx)
959+
.region_param(param, tcx)
960960
}
961961
}
962962

@@ -973,7 +973,7 @@ impl<'a, 'gcx, 'tcx> Generics {
973973
}
974974
} else {
975975
tcx.generics_of(self.parent.expect("parent_count>0 but no parent?"))
976-
.type_param(param, tcx)
976+
.type_param(param, tcx)
977977
}
978978
}
979979
}
@@ -2192,7 +2192,7 @@ impl<'a, 'gcx, 'tcx> AdtDef {
21922192
if !expr_did.is_local() {
21932193
span_bug!(tcx.def_span(expr_did),
21942194
"variant discriminant evaluation succeeded \
2195-
in its crate but failed locally");
2195+
in its crate but failed locally");
21962196
}
21972197
None
21982198
}
@@ -2328,9 +2328,9 @@ impl<'a, 'gcx, 'tcx> AdtDef {
23282328
debug!("sized_constraint_for_ty({:?}) intermediate = {:?}",
23292329
ty, adt_tys);
23302330
adt_tys.iter()
2331-
.map(|ty| ty.subst(tcx, substs))
2332-
.flat_map(|ty| self.sized_constraint_for_ty(tcx, ty))
2333-
.collect()
2331+
.map(|ty| ty.subst(tcx, substs))
2332+
.flat_map(|ty| self.sized_constraint_for_ty(tcx, ty))
2333+
.collect()
23342334
}
23352335

23362336
Projection(..) | Opaque(..) => {
@@ -2869,9 +2869,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
28692869
}
28702870
}
28712871

2872-
fn associated_item<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId)
2873-
-> AssociatedItem
2874-
{
2872+
fn associated_item<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) -> AssociatedItem {
28752873
let id = tcx.hir.as_local_node_id(def_id).unwrap();
28762874
let parent_id = tcx.hir.get_parent(id);
28772875
let parent_def_id = tcx.hir.local_def_id(parent_id);
@@ -2985,8 +2983,8 @@ pub fn is_impl_trait_defn(tcx: TyCtxt<'_, '_, '_>, def_id: DefId) -> Option<DefI
29852983
/// See `ParamEnv` struct def'n for details.
29862984
fn param_env<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
29872985
def_id: DefId)
2988-
-> ParamEnv<'tcx> {
2989-
2986+
-> ParamEnv<'tcx>
2987+
{
29902988
// The param_env of an impl Trait type is its defining function's param_env
29912989
if let Some(parent) = is_impl_trait_defn(tcx, def_id) {
29922990
return param_env(tcx, parent);

src/librustc/ty/outlives.rs

-1
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,6 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
7373
// projection).
7474
match ty.sty {
7575
ty::Closure(def_id, ref substs) => {
76-
7776
for upvar_ty in substs.upvar_tys(def_id, *self) {
7877
self.compute_components(upvar_ty, out);
7978
}

src/librustc/ty/relate.rs

+4-3
Original file line numberDiff line numberDiff line change
@@ -274,9 +274,10 @@ impl<'tcx> Relate<'tcx> for Vec<ty::PolyExistentialProjection<'tcx>> {
274274
if a.len() != b.len() {
275275
Err(TypeError::ProjectionBoundsLength(expected_found(relation, &a.len(), &b.len())))
276276
} else {
277-
a.iter().zip(b)
278-
.map(|(a, b)| relation.relate(a, b))
279-
.collect()
277+
a.iter()
278+
.zip(b)
279+
.map(|(a, b)| relation.relate(a, b))
280+
.collect()
280281
}
281282
}
282283
}

src/librustc/ty/structural_impls.rs

+6-7
Original file line numberDiff line numberDiff line change
@@ -386,12 +386,12 @@ impl<'a, 'tcx> Lift<'tcx> for ty::GenSig<'a> {
386386
type Lifted = ty::GenSig<'tcx>;
387387
fn lift_to_tcx<'b, 'gcx>(&self, tcx: TyCtxt<'b, 'gcx, 'tcx>) -> Option<Self::Lifted> {
388388
tcx.lift(&(self.yield_ty, self.return_ty))
389-
.map(|(yield_ty, return_ty)| {
390-
ty::GenSig {
391-
yield_ty,
392-
return_ty,
393-
}
394-
})
389+
.map(|(yield_ty, return_ty)| {
390+
ty::GenSig {
391+
yield_ty,
392+
return_ty,
393+
}
394+
})
395395
}
396396
}
397397

@@ -452,7 +452,6 @@ impl<'a, 'tcx> Lift<'tcx> for ty::error::TypeError<'a> {
452452
CyclicTy(t) => return tcx.lift(&t).map(|t| CyclicTy(t)),
453453
ProjectionMismatched(x) => ProjectionMismatched(x),
454454
ProjectionBoundsLength(x) => ProjectionBoundsLength(x),
455-
456455
Sorts(ref x) => return tcx.lift(x).map(Sorts),
457456
OldStyleLUB(ref x) => return tcx.lift(x).map(OldStyleLUB),
458457
ExistentialMismatch(ref x) => return tcx.lift(x).map(ExistentialMismatch)

src/librustc/ty/subst.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -361,7 +361,7 @@ impl<'tcx> serialize::UseSpecializedDecodable for &'tcx Substs<'tcx> {}
361361

362362
pub trait Subst<'tcx> : Sized {
363363
fn subst<'a, 'gcx>(&self, tcx: TyCtxt<'a, 'gcx, 'tcx>,
364-
substs: &[Kind<'tcx>]) -> Self {
364+
substs: &[Kind<'tcx>]) -> Self {
365365
self.subst_spanned(tcx, substs, None)
366366
}
367367

@@ -489,7 +489,7 @@ impl<'a, 'gcx, 'tcx> SubstFolder<'a, 'gcx, 'tcx> {
489489
span_bug!(
490490
span,
491491
"Type parameter `{:?}` ({:?}/{}) out of range \
492-
when substituting (root type={:?}) substs={:?}",
492+
when substituting (root type={:?}) substs={:?}",
493493
p,
494494
source_ty,
495495
p.idx,

src/librustc/ty/trait_def.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -173,9 +173,9 @@ pub(super) fn trait_impls_of_provider<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
173173
fast_reject::simplify_type(tcx, impl_self_ty, false)
174174
{
175175
impls.non_blanket_impls
176-
.entry(simplified_self_ty)
177-
.or_default()
178-
.push(impl_def_id);
176+
.entry(simplified_self_ty)
177+
.or_default()
178+
.push(impl_def_id);
179179
} else {
180180
impls.blanket_impls.push(impl_def_id);
181181
}

src/librustc/ty/util.rs

+11-9
Original file line numberDiff line numberDiff line change
@@ -119,17 +119,17 @@ pub trait IntTypeExt {
119119
impl IntTypeExt for attr::IntType {
120120
fn to_ty<'a, 'gcx, 'tcx>(&self, tcx: TyCtxt<'a, 'gcx, 'tcx>) -> Ty<'tcx> {
121121
match *self {
122-
SignedInt(ast::IntTy::I8) => tcx.types.i8,
123-
SignedInt(ast::IntTy::I16) => tcx.types.i16,
124-
SignedInt(ast::IntTy::I32) => tcx.types.i32,
125-
SignedInt(ast::IntTy::I64) => tcx.types.i64,
122+
SignedInt(ast::IntTy::I8) => tcx.types.i8,
123+
SignedInt(ast::IntTy::I16) => tcx.types.i16,
124+
SignedInt(ast::IntTy::I32) => tcx.types.i32,
125+
SignedInt(ast::IntTy::I64) => tcx.types.i64,
126126
SignedInt(ast::IntTy::I128) => tcx.types.i128,
127-
SignedInt(ast::IntTy::Isize) => tcx.types.isize,
127+
SignedInt(ast::IntTy::Isize) => tcx.types.isize,
128128
UnsignedInt(ast::UintTy::U8) => tcx.types.u8,
129129
UnsignedInt(ast::UintTy::U16) => tcx.types.u16,
130130
UnsignedInt(ast::UintTy::U32) => tcx.types.u32,
131131
UnsignedInt(ast::UintTy::U64) => tcx.types.u64,
132-
UnsignedInt(ast::UintTy::U128) => tcx.types.u128,
132+
UnsignedInt(ast::UintTy::U128) => tcx.types.u128,
133133
UnsignedInt(ast::UintTy::Usize) => tcx.types.usize,
134134
}
135135
}
@@ -513,7 +513,9 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
513513
false
514514
}
515515
}
516-
}).map(|(&item_param, _)| item_param).collect();
516+
})
517+
.map(|(&item_param, _)| item_param)
518+
.collect();
517519
debug!("destructor_constraint({:?}) = {:?}", def.did, result);
518520
result
519521
}
@@ -674,8 +676,8 @@ impl<'a, 'tcx> ty::TyS<'tcx> {
674676
pub fn is_representable(&'tcx self,
675677
tcx: TyCtxt<'a, 'tcx, 'tcx>,
676678
sp: Span)
677-
-> Representability {
678-
679+
-> Representability
680+
{
679681
// Iterate until something non-representable is found
680682
fn fold_repr<It: Iterator<Item=Representability>>(iter: It) -> Representability {
681683
iter.fold(Representability::Representable, |r1, r2| {

0 commit comments

Comments
 (0)