Skip to content

Commit 4d14c66

Browse files
committed
shorten long lines
1 parent cd23553 commit 4d14c66

File tree

8 files changed

+76
-26
lines changed

8 files changed

+76
-26
lines changed

src/librustc/infer/combine.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -356,7 +356,8 @@ impl<'cx, 'gcx, 'tcx> TypeFolder<'gcx, 'tcx> for Generalizer<'cx, 'gcx, 'tcx> {
356356
-> RelateResult<'tcx, T>
357357
{
358358
let old_ambient_variance = self.ambient_variance;
359-
debug!("Generalize: fold_with_variance({:?}, {:?}, old_variance={:?})", variance, a, old_ambient_variance);
359+
debug!("Generalize: fold_with_variance({:?}, {:?}, old_variance={:?})",
360+
variance, a, old_ambient_variance);
360361
self.ambient_variance = self.ambient_variance.xform(variance);
361362

362363
let result = a.fold_with(self);

src/librustc/mir/mod.rs

+15-5
Original file line numberDiff line numberDiff line change
@@ -2624,7 +2624,9 @@ impl<'tcx> UserTypeProjection<'tcx> {
26242624
CloneTypeFoldableAndLiftImpls! { ProjectionKind<'tcx>, }
26252625

26262626
impl<'tcx> TypeFoldable<'tcx> for UserTypeProjection<'tcx> {
2627-
fn super_fold_with<'gcx: 'tcx, F: TypeFolder<'gcx, 'tcx>>(&self, folder: &mut F) -> Result<Self, F::Error> {
2627+
fn super_fold_with<'gcx: 'tcx, F: TypeFolder<'gcx, 'tcx>>(&self, folder: &mut F)
2628+
-> Result<Self, F::Error>
2629+
{
26282630
use crate::mir::ProjectionElem::*;
26292631

26302632
let base = self.base.fold_with(folder)?;
@@ -3115,7 +3117,9 @@ EnumTypeFoldableImpl! {
31153117
}
31163118

31173119
impl<'tcx> TypeFoldable<'tcx> for Terminator<'tcx> {
3118-
fn super_fold_with<'gcx: 'tcx, F: TypeFolder<'gcx, 'tcx>>(&self, folder: &mut F) -> Result<Self, F::Error> {
3120+
fn super_fold_with<'gcx: 'tcx, F: TypeFolder<'gcx, 'tcx>>(&self, folder: &mut F)
3121+
-> Result<Self, F::Error>
3122+
{
31193123
use crate::mir::TerminatorKind::*;
31203124

31213125
let kind = match self.kind {
@@ -3283,7 +3287,9 @@ impl<'tcx> TypeFoldable<'tcx> for Terminator<'tcx> {
32833287

32843288
impl<'tcx> TypeFoldable<'tcx> for Place<'tcx> {
32853289
// TODO: this doesn't look correct!
3286-
fn super_fold_with<'gcx: 'tcx, F: TypeFolder<'gcx, 'tcx>>(&self, folder: &mut F) -> Result<Self, F::Error> {
3290+
fn super_fold_with<'gcx: 'tcx, F: TypeFolder<'gcx, 'tcx>>(&self, folder: &mut F)
3291+
-> Result<Self, F::Error>
3292+
{
32873293
match self {
32883294
&Place::Projection(ref p) => Ok(Place::Projection(p.fold_with(folder)?)),
32893295
_ => Ok(self.clone()),
@@ -3300,7 +3306,9 @@ impl<'tcx> TypeFoldable<'tcx> for Place<'tcx> {
33003306
}
33013307

33023308
impl<'tcx> TypeFoldable<'tcx> for Rvalue<'tcx> {
3303-
fn super_fold_with<'gcx: 'tcx, F: TypeFolder<'gcx, 'tcx>>(&self, folder: &mut F) -> Result<Self, F::Error> {
3309+
fn super_fold_with<'gcx: 'tcx, F: TypeFolder<'gcx, 'tcx>>(&self, folder: &mut F)
3310+
-> Result<Self, F::Error>
3311+
{
33043312
use crate::mir::Rvalue::*;
33053313
Ok(match *self {
33063314
Use(ref op) => Use(op.fold_with(folder)?),
@@ -3389,7 +3397,9 @@ where
33893397
V: TypeFoldable<'tcx>,
33903398
T: TypeFoldable<'tcx>,
33913399
{
3392-
fn super_fold_with<'gcx: 'tcx, F: TypeFolder<'gcx, 'tcx>>(&self, folder: &mut F) -> Result<Self, F::Error> {
3400+
fn super_fold_with<'gcx: 'tcx, F: TypeFolder<'gcx, 'tcx>>(&self, folder: &mut F)
3401+
-> Result<Self, F::Error>
3402+
{
33933403
use crate::mir::ProjectionElem::*;
33943404

33953405
let base = self.base.fold_with(folder)?;

src/librustc/traits/project.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -395,7 +395,9 @@ impl<'a, 'b, 'gcx, 'tcx> TypeFolder<'gcx, 'tcx> for AssociatedTypeNormalizer<'a,
395395
})
396396
}
397397

398-
fn fold_const(&mut self, constant: &'tcx ty::LazyConst<'tcx>) -> Result<&'tcx ty::LazyConst<'tcx>, !> {
398+
fn fold_const(&mut self, constant: &'tcx ty::LazyConst<'tcx>)
399+
-> Result<&'tcx ty::LazyConst<'tcx>, !>
400+
{
399401
if let ty::LazyConst::Unevaluated(def_id, substs) = *constant {
400402
let tcx = self.selcx.tcx().global_tcx();
401403
if let Some(param_env) = self.tcx().lift_to_global(&self.param_env) {

src/librustc/traits/query/normalize.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,9 @@ impl<'cx, 'gcx, 'tcx> TypeFolder<'gcx, 'tcx> for QueryNormalizer<'cx, 'gcx, 'tcx
191191
}
192192
}
193193

194-
fn fold_const(&mut self, constant: &'tcx ty::LazyConst<'tcx>) -> Result<&'tcx ty::LazyConst<'tcx>, !> {
194+
fn fold_const(&mut self, constant: &'tcx ty::LazyConst<'tcx>)
195+
-> Result<&'tcx ty::LazyConst<'tcx>, !>
196+
{
195197
if let ty::LazyConst::Unevaluated(def_id, substs) = *constant {
196198
let tcx = self.infcx.tcx.global_tcx();
197199
if let Some(param_env) = self.tcx().lift_to_global(&self.param_env) {

src/librustc/traits/structural_impls.rs

+15-5
Original file line numberDiff line numberDiff line change
@@ -759,7 +759,9 @@ where
759759
// TypeFoldable implementations.
760760

761761
impl<'tcx, O: TypeFoldable<'tcx>> TypeFoldable<'tcx> for traits::Obligation<'tcx, O> {
762-
fn super_fold_with<'gcx: 'tcx, F: TypeFolder<'gcx, 'tcx>>(&self, folder: &mut F) -> Result<Self, F::Error> {
762+
fn super_fold_with<'gcx: 'tcx, F: TypeFolder<'gcx, 'tcx>>(&self, folder: &mut F)
763+
-> Result<Self, F::Error>
764+
{
763765
Ok(traits::Obligation {
764766
cause: self.cause.clone(),
765767
recursion_depth: self.recursion_depth,
@@ -893,7 +895,9 @@ EnumTypeFoldableImpl! {
893895
}
894896

895897
impl<'tcx> TypeFoldable<'tcx> for &'tcx ty::List<traits::Goal<'tcx>> {
896-
fn super_fold_with<'gcx: 'tcx, F: TypeFolder<'gcx, 'tcx>>(&self, folder: &mut F) -> Result<Self, F::Error> {
898+
fn super_fold_with<'gcx: 'tcx, F: TypeFolder<'gcx, 'tcx>>(&self, folder: &mut F)
899+
-> Result<Self, F::Error>
900+
{
897901
let v = self.iter()
898902
.map(|t| t.fold_with(folder))
899903
.collect::<Result<SmallVec<[_; 8]>, _>>()?;
@@ -909,7 +913,9 @@ impl<'tcx> TypeFoldable<'tcx> for &'tcx ty::List<traits::Goal<'tcx>> {
909913
}
910914

911915
impl<'tcx> TypeFoldable<'tcx> for traits::Goal<'tcx> {
912-
fn super_fold_with<'gcx: 'tcx, F: TypeFolder<'gcx, 'tcx>>(&self, folder: &mut F) -> Result<Self, F::Error> {
916+
fn super_fold_with<'gcx: 'tcx, F: TypeFolder<'gcx, 'tcx>>(&self, folder: &mut F)
917+
-> Result<Self, F::Error>
918+
{
913919
let v = (**self).fold_with(folder);
914920
Ok(folder.tcx().mk_goal(v?))
915921
}
@@ -950,7 +956,9 @@ BraceStructTypeFoldableImpl! {
950956
}
951957

952958
impl<'tcx> TypeFoldable<'tcx> for traits::Clauses<'tcx> {
953-
fn super_fold_with<'gcx: 'tcx, F: TypeFolder<'gcx, 'tcx>>(&self, folder: &mut F) -> Result<Self, F::Error> {
959+
fn super_fold_with<'gcx: 'tcx, F: TypeFolder<'gcx, 'tcx>>(&self, folder: &mut F)
960+
-> Result<Self, F::Error>
961+
{
954962
let v = self.iter()
955963
.map(|t| t.fold_with(folder))
956964
.collect::<Result<SmallVec<[_; 8]>, _>>();
@@ -971,7 +979,9 @@ where
971979
C::Substitution: Clone,
972980
C::RegionConstraint: Clone,
973981
{
974-
fn super_fold_with<'gcx: 'tcx, F: TypeFolder<'gcx, 'tcx>>(&self, folder: &mut F) -> Result<Self, F::Error> {
982+
fn super_fold_with<'gcx: 'tcx, F: TypeFolder<'gcx, 'tcx>>(&self, folder: &mut F)
983+
-> Result<Self, F::Error>
984+
{
975985
<C as traits::ExClauseFold>::fold_ex_clause_with(
976986
self,
977987
folder,

src/librustc/ty/fold.rs

+19-7
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,11 @@ use crate::util::nodemap::FxHashSet;
4545
/// To implement this conveniently, use the
4646
/// `BraceStructTypeFoldableImpl` etc macros found in `macros.rs`.
4747
pub trait TypeFoldable<'tcx>: fmt::Debug + Clone {
48-
fn super_fold_with<'gcx: 'tcx, F: TypeFolder<'gcx, 'tcx>>(&self, folder: &mut F) -> Result<Self, F::Error>;
49-
fn fold_with<'gcx: 'tcx, F: TypeFolder<'gcx, 'tcx>>(&self, folder: &mut F) -> Result<Self, F::Error> {
48+
fn super_fold_with<'gcx: 'tcx, F: TypeFolder<'gcx, 'tcx>>
49+
(&self, folder: &mut F) -> Result<Self, F::Error>;
50+
fn fold_with<'gcx: 'tcx, F: TypeFolder<'gcx, 'tcx>>
51+
(&self, folder: &mut F) -> Result<Self, F::Error>
52+
{
5053
self.super_fold_with(folder)
5154
}
5255

@@ -188,7 +191,8 @@ pub trait TypeFolder<'gcx: 'tcx, 'tcx> : Sized {
188191
}
189192

190193
#[inline]
191-
fn fold_with_variance<T>(&mut self, _variance: ty::Variance, t: &T) -> Result<T, Self::Error>
194+
fn fold_with_variance<T>(&mut self, _variance: ty::Variance, t: &T)
195+
-> Result<T, Self::Error>
192196
where T : TypeFoldable<'tcx>
193197
{
194198
t.fold_with(self)
@@ -202,7 +206,9 @@ pub trait TypeFolder<'gcx: 'tcx, 'tcx> : Sized {
202206
r.super_fold_with(self)
203207
}
204208

205-
fn fold_const(&mut self, c: &'tcx ty::LazyConst<'tcx>) -> Result<&'tcx ty::LazyConst<'tcx>, Self::Error> {
209+
fn fold_const(&mut self, c: &'tcx ty::LazyConst<'tcx>)
210+
-> Result<&'tcx ty::LazyConst<'tcx>, Self::Error>
211+
{
206212
c.super_fold_with(self)
207213
}
208214
}
@@ -432,7 +438,9 @@ impl<'a, 'gcx, 'tcx> TypeFolder<'gcx, 'tcx> for RegionFolder<'a, 'gcx, 'tcx> {
432438

433439
fn tcx<'b>(&'b self) -> TyCtxt<'b, 'gcx, 'tcx> { self.tcx }
434440

435-
fn fold_binder<T: TypeFoldable<'tcx>>(&mut self, t: &ty::Binder<T>) -> Result<ty::Binder<T>, !> {
441+
fn fold_binder<T: TypeFoldable<'tcx>>(&mut self, t: &ty::Binder<T>)
442+
-> Result<ty::Binder<T>, !>
443+
{
436444
self.current_index.shift_in(1);
437445
let t = t.super_fold_with(self);
438446
self.current_index.shift_out(1);
@@ -494,7 +502,9 @@ impl<'a, 'gcx, 'tcx> TypeFolder<'gcx, 'tcx> for BoundVarReplacer<'a, 'gcx, 'tcx>
494502

495503
fn tcx<'b>(&'b self) -> TyCtxt<'b, 'gcx, 'tcx> { self.tcx }
496504

497-
fn fold_binder<T: TypeFoldable<'tcx>>(&mut self, t: &ty::Binder<T>) -> Result<ty::Binder<T>, !> {
505+
fn fold_binder<T: TypeFoldable<'tcx>>(&mut self, t: &ty::Binder<T>)
506+
-> Result<ty::Binder<T>, !>
507+
{
498508
self.current_index.shift_in(1);
499509
let t = t.super_fold_with(self);
500510
self.current_index.shift_out(1);
@@ -732,7 +742,9 @@ impl TypeFolder<'gcx, 'tcx> for Shifter<'a, 'gcx, 'tcx> {
732742

733743
fn tcx<'b>(&'b self) -> TyCtxt<'b, 'gcx, 'tcx> { self.tcx }
734744

735-
fn fold_binder<T: TypeFoldable<'tcx>>(&mut self, t: &ty::Binder<T>) -> Result<ty::Binder<T>, !> {
745+
fn fold_binder<T: TypeFoldable<'tcx>>(&mut self, t: &ty::Binder<T>)
746+
-> Result<ty::Binder<T>, !>
747+
{
736748
self.current_index.shift_in(1);
737749
let t = t.super_fold_with(self);
738750
self.current_index.shift_out(1);

src/librustc/ty/structural_impls.rs

+13-4
Original file line numberDiff line numberDiff line change
@@ -596,7 +596,10 @@ impl<'tcx, T: TypeFoldable<'tcx>> TypeFoldable<'tcx> for Box<[T]> {
596596
fn super_fold_with<'gcx: 'tcx, F: TypeFolder<'gcx, 'tcx>>(&self, folder: &mut F)
597597
-> Result<Self, F::Error>
598598
{
599-
Ok(self.iter().map(|t| t.fold_with(folder)).collect::<Result<Vec<_>, _>>()?.into_boxed_slice())
599+
Ok(self.iter()
600+
.map(|t| t.fold_with(folder))
601+
.collect::<Result<Vec<_>, _>>()?
602+
.into_boxed_slice())
600603
}
601604

602605
fn super_visit_with<V: TypeVisitor<'tcx>>(&self, visitor: &mut V) -> Result<(), V::Error> {
@@ -821,7 +824,9 @@ impl<'tcx> TypeFoldable<'tcx> for Ty<'tcx> {
821824
}
822825
}
823826

824-
fn fold_with<'gcx: 'tcx, F: TypeFolder<'gcx, 'tcx>>(&self, folder: &mut F) -> Result<Self, F::Error> {
827+
fn fold_with<'gcx: 'tcx, F: TypeFolder<'gcx, 'tcx>>(&self, folder: &mut F)
828+
-> Result<Self, F::Error>
829+
{
825830
folder.fold_ty(*self)
826831
}
827832

@@ -968,7 +973,9 @@ impl<'tcx> TypeFoldable<'tcx> for ty::Region<'tcx> {
968973
Ok(*self)
969974
}
970975

971-
fn fold_with<'gcx: 'tcx, F: TypeFolder<'gcx, 'tcx>>(&self, folder: &mut F) -> Result<Self, F::Error> {
976+
fn fold_with<'gcx: 'tcx, F: TypeFolder<'gcx, 'tcx>>(&self, folder: &mut F)
977+
-> Result<Self, F::Error>
978+
{
972979
folder.fold_region(*self)
973980
}
974981

@@ -1173,7 +1180,9 @@ impl<'tcx> TypeFoldable<'tcx> for &'tcx ty::LazyConst<'tcx> {
11731180
Ok(folder.tcx().mk_lazy_const(new))
11741181
}
11751182

1176-
fn fold_with<'gcx: 'tcx, F: TypeFolder<'gcx, 'tcx>>(&self, folder: &mut F) -> Result<Self, F::Error> {
1183+
fn fold_with<'gcx: 'tcx, F: TypeFolder<'gcx, 'tcx>>(&self, folder: &mut F)
1184+
-> Result<Self, F::Error>
1185+
{
11771186
folder.fold_const(*self)
11781187
}
11791188

src/librustc/ty/subst.rs

+6-2
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,9 @@ impl<'a, 'tcx> Lift<'tcx> for Kind<'a> {
129129
}
130130

131131
impl<'tcx> TypeFoldable<'tcx> for Kind<'tcx> {
132-
fn super_fold_with<'gcx: 'tcx, F: TypeFolder<'gcx, 'tcx>>(&self, folder: &mut F) -> Result<Self, F::Error> {
132+
fn super_fold_with<'gcx: 'tcx, F: TypeFolder<'gcx, 'tcx>>(&self, folder: &mut F)
133+
-> Result<Self, F::Error>
134+
{
133135
match self.unpack() {
134136
UnpackedKind::Lifetime(lt) => lt.fold_with(folder).map(|a| a.into()),
135137
UnpackedKind::Type(ty) => ty.fold_with(folder).map(|a| a.into()),
@@ -432,7 +434,9 @@ impl<'a, 'gcx, 'tcx> TypeFolder<'gcx, 'tcx> for SubstFolder<'a, 'gcx, 'tcx> {
432434

433435
fn tcx<'b>(&'b self) -> TyCtxt<'b, 'gcx, 'tcx> { self.tcx }
434436

435-
fn fold_binder<T: TypeFoldable<'tcx>>(&mut self, t: &ty::Binder<T>) -> Result<ty::Binder<T>, !> {
437+
fn fold_binder<T: TypeFoldable<'tcx>>(&mut self, t: &ty::Binder<T>)
438+
-> Result<ty::Binder<T>, !>
439+
{
436440
self.binders_passed += 1;
437441
let t = t.super_fold_with(self);
438442
self.binders_passed -= 1;

0 commit comments

Comments
 (0)