Skip to content

Commit bf0e4cb

Browse files
committed
shorten long lines
1 parent f8c9478 commit bf0e4cb

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
@@ -375,7 +375,8 @@ impl<'cx, 'gcx, 'tcx> TypeFolder<'gcx, 'tcx> for Generalizer<'cx, 'gcx, 'tcx> {
375375
-> RelateResult<'tcx, T>
376376
{
377377
let old_ambient_variance = self.ambient_variance;
378-
debug!("Generalize: fold_with_variance({:?}, {:?}, old_variance={:?})", variance, a, old_ambient_variance);
378+
debug!("Generalize: fold_with_variance({:?}, {:?}, old_variance={:?})",
379+
variance, a, old_ambient_variance);
379380
self.ambient_variance = self.ambient_variance.xform(variance);
380381

381382
let result = a.fold_with(self);

src/librustc/mir/mod.rs

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

26432643
impl<'tcx> TypeFoldable<'tcx> for UserTypeProjection<'tcx> {
2644-
fn super_fold_with<'gcx: 'tcx, F: TypeFolder<'gcx, 'tcx>>(&self, folder: &mut F) -> Result<Self, F::Error> {
2644+
fn super_fold_with<'gcx: 'tcx, F: TypeFolder<'gcx, 'tcx>>(&self, folder: &mut F)
2645+
-> Result<Self, F::Error>
2646+
{
26452647
use crate::mir::ProjectionElem::*;
26462648

26472649
let base = self.base.fold_with(folder)?;
@@ -3132,7 +3134,9 @@ EnumTypeFoldableImpl! {
31323134
}
31333135

31343136
impl<'tcx> TypeFoldable<'tcx> for Terminator<'tcx> {
3135-
fn super_fold_with<'gcx: 'tcx, F: TypeFolder<'gcx, 'tcx>>(&self, folder: &mut F) -> Result<Self, F::Error> {
3137+
fn super_fold_with<'gcx: 'tcx, F: TypeFolder<'gcx, 'tcx>>(&self, folder: &mut F)
3138+
-> Result<Self, F::Error>
3139+
{
31363140
use crate::mir::TerminatorKind::*;
31373141

31383142
let kind = match self.kind {
@@ -3300,7 +3304,9 @@ impl<'tcx> TypeFoldable<'tcx> for Terminator<'tcx> {
33003304

33013305
impl<'tcx> TypeFoldable<'tcx> for Place<'tcx> {
33023306
// TODO: this doesn't look correct!
3303-
fn super_fold_with<'gcx: 'tcx, F: TypeFolder<'gcx, 'tcx>>(&self, folder: &mut F) -> Result<Self, F::Error> {
3307+
fn super_fold_with<'gcx: 'tcx, F: TypeFolder<'gcx, 'tcx>>(&self, folder: &mut F)
3308+
-> Result<Self, F::Error>
3309+
{
33043310
match self {
33053311
&Place::Projection(ref p) => Ok(Place::Projection(p.fold_with(folder)?)),
33063312
_ => Ok(self.clone()),
@@ -3317,7 +3323,9 @@ impl<'tcx> TypeFoldable<'tcx> for Place<'tcx> {
33173323
}
33183324

33193325
impl<'tcx> TypeFoldable<'tcx> for Rvalue<'tcx> {
3320-
fn super_fold_with<'gcx: 'tcx, F: TypeFolder<'gcx, 'tcx>>(&self, folder: &mut F) -> Result<Self, F::Error> {
3326+
fn super_fold_with<'gcx: 'tcx, F: TypeFolder<'gcx, 'tcx>>(&self, folder: &mut F)
3327+
-> Result<Self, F::Error>
3328+
{
33213329
use crate::mir::Rvalue::*;
33223330
Ok(match *self {
33233331
Use(ref op) => Use(op.fold_with(folder)?),
@@ -3406,7 +3414,9 @@ where
34063414
V: TypeFoldable<'tcx>,
34073415
T: TypeFoldable<'tcx>,
34083416
{
3409-
fn super_fold_with<'gcx: 'tcx, F: TypeFolder<'gcx, 'tcx>>(&self, folder: &mut F) -> Result<Self, F::Error> {
3417+
fn super_fold_with<'gcx: 'tcx, F: TypeFolder<'gcx, 'tcx>>(&self, folder: &mut F)
3418+
-> Result<Self, F::Error>
3419+
{
34103420
use crate::mir::ProjectionElem::*;
34113421

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

src/librustc/traits/project.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -398,7 +398,9 @@ impl<'a, 'b, 'gcx, 'tcx> TypeFolder<'gcx, 'tcx> for AssociatedTypeNormalizer<'a,
398398
})
399399
}
400400

401-
fn fold_const(&mut self, constant: &'tcx ty::LazyConst<'tcx>) -> Result<&'tcx ty::LazyConst<'tcx>, !> {
401+
fn fold_const(&mut self, constant: &'tcx ty::LazyConst<'tcx>)
402+
-> Result<&'tcx ty::LazyConst<'tcx>, !>
403+
{
402404
if let ty::LazyConst::Unevaluated(def_id, substs) = *constant {
403405
let tcx = self.selcx.tcx().global_tcx();
404406
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
@@ -602,7 +602,10 @@ impl<'tcx, T: TypeFoldable<'tcx>> TypeFoldable<'tcx> for Box<[T]> {
602602
fn super_fold_with<'gcx: 'tcx, F: TypeFolder<'gcx, 'tcx>>(&self, folder: &mut F)
603603
-> Result<Self, F::Error>
604604
{
605-
Ok(self.iter().map(|t| t.fold_with(folder)).collect::<Result<Vec<_>, _>>()?.into_boxed_slice())
605+
Ok(self.iter()
606+
.map(|t| t.fold_with(folder))
607+
.collect::<Result<Vec<_>, _>>()?
608+
.into_boxed_slice())
606609
}
607610

608611
fn super_visit_with<V: TypeVisitor<'tcx>>(&self, visitor: &mut V) -> Result<(), V::Error> {
@@ -827,7 +830,9 @@ impl<'tcx> TypeFoldable<'tcx> for Ty<'tcx> {
827830
}
828831
}
829832

830-
fn fold_with<'gcx: 'tcx, F: TypeFolder<'gcx, 'tcx>>(&self, folder: &mut F) -> Result<Self, F::Error> {
833+
fn fold_with<'gcx: 'tcx, F: TypeFolder<'gcx, 'tcx>>(&self, folder: &mut F)
834+
-> Result<Self, F::Error>
835+
{
831836
folder.fold_ty(*self)
832837
}
833838

@@ -974,7 +979,9 @@ impl<'tcx> TypeFoldable<'tcx> for ty::Region<'tcx> {
974979
Ok(*self)
975980
}
976981

977-
fn fold_with<'gcx: 'tcx, F: TypeFolder<'gcx, 'tcx>>(&self, folder: &mut F) -> Result<Self, F::Error> {
982+
fn fold_with<'gcx: 'tcx, F: TypeFolder<'gcx, 'tcx>>(&self, folder: &mut F)
983+
-> Result<Self, F::Error>
984+
{
978985
folder.fold_region(*self)
979986
}
980987

@@ -1181,7 +1188,9 @@ impl<'tcx> TypeFoldable<'tcx> for &'tcx ty::LazyConst<'tcx> {
11811188
Ok(folder.tcx().mk_lazy_const(new))
11821189
}
11831190

1184-
fn fold_with<'gcx: 'tcx, F: TypeFolder<'gcx, 'tcx>>(&self, folder: &mut F) -> Result<Self, F::Error> {
1191+
fn fold_with<'gcx: 'tcx, F: TypeFolder<'gcx, 'tcx>>(&self, folder: &mut F)
1192+
-> Result<Self, F::Error>
1193+
{
11851194
folder.fold_const(*self)
11861195
}
11871196

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()),
@@ -434,7 +436,9 @@ impl<'a, 'gcx, 'tcx> TypeFolder<'gcx, 'tcx> for SubstFolder<'a, 'gcx, 'tcx> {
434436

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

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

0 commit comments

Comments
 (0)