Skip to content

Commit 960bdcc

Browse files
committed
Apply formatting fixes
1 parent 43f42d2 commit 960bdcc

File tree

3 files changed

+27
-34
lines changed

3 files changed

+27
-34
lines changed

compiler/rustc_mir_transform/src/shim.rs

Lines changed: 6 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ use rustc_hir::lang_items::LangItem;
44
use rustc_middle::mir::*;
55
use rustc_middle::ty::query::Providers;
66
use rustc_middle::ty::subst::{InternalSubsts, Subst};
7-
use rustc_middle::ty::{self, Ty, TyCtxt, GeneratorSubsts};
7+
use rustc_middle::ty::{self, GeneratorSubsts, Ty, TyCtxt};
88
use rustc_target::abi::VariantIdx;
99

1010
use rustc_index::vec::{Idx, IndexVec};
@@ -484,32 +484,20 @@ impl<'tcx> CloneShimBuilder<'tcx> {
484484
self.make_clone_call(dest_field, src_field, ity, next_block, unwind);
485485
self.block(
486486
vec![],
487-
TerminatorKind::Drop {
488-
place: dest_field,
489-
target: unwind,
490-
unwind: None,
491-
},
487+
TerminatorKind::Drop { place: dest_field, target: unwind, unwind: None },
492488
true,
493489
);
494490
unwind = next_unwind;
495491
}
496-
self.block(
497-
vec![],
498-
TerminatorKind::Goto { target },
499-
false,
500-
);
492+
self.block(vec![], TerminatorKind::Goto { target }, false);
501493
unwind
502494
}
503495

504496
fn tuple_like_shim<I>(&mut self, dest: Place<'tcx>, src: Place<'tcx>, tys: I)
505497
where
506498
I: IntoIterator<Item = Ty<'tcx>>,
507499
{
508-
self.block(
509-
vec![],
510-
TerminatorKind::Goto { target: self.block_index_offset(3) },
511-
false,
512-
);
500+
self.block(vec![], TerminatorKind::Goto { target: self.block_index_offset(3) }, false);
513501
let unwind = self.block(vec![], TerminatorKind::Resume, true);
514502
let target = self.block(vec![], TerminatorKind::Return, false);
515503

@@ -523,11 +511,7 @@ impl<'tcx> CloneShimBuilder<'tcx> {
523511
gen_def_id: DefId,
524512
substs: GeneratorSubsts<'tcx>,
525513
) {
526-
self.block(
527-
vec![],
528-
TerminatorKind::Goto { target: self.block_index_offset(3) },
529-
false,
530-
);
514+
self.block(vec![], TerminatorKind::Goto { target: self.block_index_offset(3) }, false);
531515
let unwind = self.block(vec![], TerminatorKind::Resume, true);
532516
// This will get overwritten with a switch once we know the target blocks
533517
let switch = self.block(vec![], TerminatorKind::Unreachable, false);
@@ -564,7 +548,7 @@ impl<'tcx> CloneShimBuilder<'tcx> {
564548
switch_ty: discr_ty,
565549
targets: SwitchTargets::new(cases.into_iter(), unreachable),
566550
};
567-
},
551+
}
568552
BasicBlockData { terminator: None, .. } => unreachable!(),
569553
}
570554
}

compiler/rustc_trait_selection/src/traits/select/mod.rs

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1898,11 +1898,13 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
18981898

18991899
ty::Generator(_, substs, hir::Movability::Movable) => {
19001900
if self.tcx().features().generator_clone {
1901-
let resolved_upvars = self.infcx.shallow_resolve(substs.as_generator().tupled_upvars_ty());
1902-
let resolved_witness = self.infcx.shallow_resolve(substs.as_generator().witness());
1901+
let resolved_upvars =
1902+
self.infcx.shallow_resolve(substs.as_generator().tupled_upvars_ty());
1903+
let resolved_witness =
1904+
self.infcx.shallow_resolve(substs.as_generator().witness());
19031905
if {
1904-
matches!(resolved_upvars.kind(), ty::Infer(ty::TyVar(_))) ||
1905-
matches!(resolved_witness.kind(), ty::Infer(ty::TyVar(_)))
1906+
matches!(resolved_upvars.kind(), ty::Infer(ty::TyVar(_)))
1907+
|| matches!(resolved_witness.kind(), ty::Infer(ty::TyVar(_)))
19061908
} {
19071909
// Not yet resolved.
19081910
Ambiguous
@@ -1926,14 +1928,21 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
19261928
if matches!(resolved.kind(), ty::Infer(ty::TyVar(_))) {
19271929
break Ambiguous;
19281930
}
1929-
},
1931+
}
19301932
Option::None => {
19311933
// (*) binder moved here
19321934
let all_vars = self.tcx().mk_bound_variable_kinds(
1933-
obligation.predicate.bound_vars().iter().chain(binder.bound_vars().iter())
1935+
obligation
1936+
.predicate
1937+
.bound_vars()
1938+
.iter()
1939+
.chain(binder.bound_vars().iter()),
19341940
);
1935-
break Where(ty::Binder::bind_with_vars(witness_tys.to_vec(), all_vars));
1936-
},
1941+
break Where(ty::Binder::bind_with_vars(
1942+
witness_tys.to_vec(),
1943+
all_vars,
1944+
));
1945+
}
19371946
}
19381947
}
19391948
}

compiler/rustc_ty_utils/src/instance.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -353,10 +353,10 @@ fn resolve_associated_item<'tcx>(
353353
let is_copy = self_ty.is_copy_modulo_regions(tcx.at(DUMMY_SP), param_env);
354354
match self_ty.kind() {
355355
_ if is_copy => (),
356-
ty::Generator(..) |
357-
ty::GeneratorWitness(..) |
358-
ty::Closure(..) |
359-
ty::Tuple(..) => {},
356+
ty::Generator(..)
357+
| ty::GeneratorWitness(..)
358+
| ty::Closure(..)
359+
| ty::Tuple(..) => {}
360360
_ => return Ok(None),
361361
};
362362

0 commit comments

Comments
 (0)