Skip to content

Commit d5d2232

Browse files
committed
auto_trait.rs: rustfmt
1 parent 672e071 commit d5d2232

File tree

1 file changed

+30
-34
lines changed

1 file changed

+30
-34
lines changed

src/librustc/traits/auto_trait.rs

Lines changed: 30 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ impl<'a, 'tcx> AutoTraitFinder<'a, 'tcx> {
227227
.iter()
228228
.filter_map(|param| match param.kind {
229229
ty::GenericParamDefKind::Lifetime => Some(param.name.to_string()),
230-
_ => None
230+
_ => None,
231231
})
232232
.collect();
233233

@@ -359,8 +359,10 @@ impl<'a, 'tcx> AutoTraitFinder<'a, 'tcx> {
359359
&Err(SelectionError::Unimplemented) => {
360360
if self.is_of_param(pred.skip_binder().trait_ref.substs) {
361361
already_visited.remove(&pred);
362-
self.add_user_pred(&mut user_computed_preds,
363-
ty::Predicate::Trait(pred.clone()));
362+
self.add_user_pred(
363+
&mut user_computed_preds,
364+
ty::Predicate::Trait(pred.clone()),
365+
);
364366
predicates.push_back(pred);
365367
} else {
366368
debug!(
@@ -418,8 +420,11 @@ impl<'a, 'tcx> AutoTraitFinder<'a, 'tcx> {
418420
// under which a type implements an auto trait. A trait predicate involving
419421
// a HRTB means that the type needs to work with any choice of lifetime,
420422
// not just one specific lifetime (e.g. 'static).
421-
fn add_user_pred<'c>(&self, user_computed_preds: &mut FxHashSet<ty::Predicate<'c>>,
422-
new_pred: ty::Predicate<'c>) {
423+
fn add_user_pred<'c>(
424+
&self,
425+
user_computed_preds: &mut FxHashSet<ty::Predicate<'c>>,
426+
new_pred: ty::Predicate<'c>,
427+
) {
423428
let mut should_add_new = true;
424429
user_computed_preds.retain(|&old_pred| {
425430
match (&new_pred, old_pred) {
@@ -431,20 +436,19 @@ impl<'a, 'tcx> AutoTraitFinder<'a, 'tcx> {
431436
if !new_substs.types().eq(old_substs.types()) {
432437
// We can't compare lifetimes if the types are different,
433438
// so skip checking old_pred
434-
return true
439+
return true;
435440
}
436441

437-
for (new_region, old_region) in new_substs
438-
.regions()
439-
.zip(old_substs.regions()) {
440-
442+
for (new_region, old_region) in
443+
new_substs.regions().zip(old_substs.regions())
444+
{
441445
match (new_region, old_region) {
442446
// If both predicates have an 'ReLateBound' (a HRTB) in the
443447
// same spot, we do nothing
444448
(
445449
ty::RegionKind::ReLateBound(_, _),
446-
ty::RegionKind::ReLateBound(_, _)
447-
) => {},
450+
ty::RegionKind::ReLateBound(_, _),
451+
) => {}
448452

449453
(ty::RegionKind::ReLateBound(_, _), _) => {
450454
// The new predicate has a HRTB in a spot where the old
@@ -458,7 +462,7 @@ impl<'a, 'tcx> AutoTraitFinder<'a, 'tcx> {
458462
// so we return 'false' to remove the old predicate from
459463
// user_computed_preds
460464
return false;
461-
},
465+
}
462466
(_, ty::RegionKind::ReLateBound(_, _)) => {
463467
// This is the opposite situation as the previous arm - the
464468
// old predicate has a HRTB lifetime in a place where the
@@ -471,10 +475,10 @@ impl<'a, 'tcx> AutoTraitFinder<'a, 'tcx> {
471475
}
472476
}
473477
}
474-
},
478+
}
475479
_ => {}
476480
}
477-
return true
481+
return true;
478482
});
479483

480484
if should_add_new {
@@ -513,44 +517,32 @@ impl<'a, 'tcx> AutoTraitFinder<'a, 'tcx> {
513517
match constraint {
514518
&Constraint::VarSubVar(r1, r2) => {
515519
{
516-
let deps1 = vid_map
517-
.entry(RegionTarget::RegionVid(r1))
518-
.or_default();
520+
let deps1 = vid_map.entry(RegionTarget::RegionVid(r1)).or_default();
519521
deps1.larger.insert(RegionTarget::RegionVid(r2));
520522
}
521523

522-
let deps2 = vid_map
523-
.entry(RegionTarget::RegionVid(r2))
524-
.or_default();
524+
let deps2 = vid_map.entry(RegionTarget::RegionVid(r2)).or_default();
525525
deps2.smaller.insert(RegionTarget::RegionVid(r1));
526526
}
527527
&Constraint::RegSubVar(region, vid) => {
528528
{
529-
let deps1 = vid_map
530-
.entry(RegionTarget::Region(region))
531-
.or_default();
529+
let deps1 = vid_map.entry(RegionTarget::Region(region)).or_default();
532530
deps1.larger.insert(RegionTarget::RegionVid(vid));
533531
}
534532

535-
let deps2 = vid_map
536-
.entry(RegionTarget::RegionVid(vid))
537-
.or_default();
533+
let deps2 = vid_map.entry(RegionTarget::RegionVid(vid)).or_default();
538534
deps2.smaller.insert(RegionTarget::Region(region));
539535
}
540536
&Constraint::VarSubReg(vid, region) => {
541537
finished_map.insert(vid, region);
542538
}
543539
&Constraint::RegSubReg(r1, r2) => {
544540
{
545-
let deps1 = vid_map
546-
.entry(RegionTarget::Region(r1))
547-
.or_default();
541+
let deps1 = vid_map.entry(RegionTarget::Region(r1)).or_default();
548542
deps1.larger.insert(RegionTarget::Region(r2));
549543
}
550544

551-
let deps2 = vid_map
552-
.entry(RegionTarget::Region(r2))
553-
.or_default();
545+
let deps2 = vid_map.entry(RegionTarget::Region(r2)).or_default();
554546
deps2.smaller.insert(RegionTarget::Region(r1));
555547
}
556548
}
@@ -683,7 +675,11 @@ impl<'a, 'tcx> AutoTraitFinder<'a, 'tcx> {
683675
}
684676
}
685677
&ty::Predicate::RegionOutlives(ref binder) => {
686-
if select.infcx().region_outlives_predicate(&dummy_cause, binder).is_err() {
678+
if select
679+
.infcx()
680+
.region_outlives_predicate(&dummy_cause, binder)
681+
.is_err()
682+
{
687683
return false;
688684
}
689685
}

0 commit comments

Comments
 (0)