Skip to content

Commit 22f4bbb

Browse files
canndrewcrlf0710
authored andcommitted
Apply formatting fixes
1 parent 8aa30dd commit 22f4bbb

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, EarlyBinder, Ty, TyCtxt, GeneratorSubsts};
7+
use rustc_middle::ty::{self, EarlyBinder, GeneratorSubsts, Ty, TyCtxt};
88
use rustc_target::abi::VariantIdx;
99

1010
use rustc_index::vec::{Idx, IndexVec};
@@ -486,32 +486,20 @@ impl<'tcx> CloneShimBuilder<'tcx> {
486486
self.make_clone_call(dest_field, src_field, ity, next_block, unwind);
487487
self.block(
488488
vec![],
489-
TerminatorKind::Drop {
490-
place: dest_field,
491-
target: unwind,
492-
unwind: None,
493-
},
489+
TerminatorKind::Drop { place: dest_field, target: unwind, unwind: None },
494490
true,
495491
);
496492
unwind = next_unwind;
497493
}
498-
self.block(
499-
vec![],
500-
TerminatorKind::Goto { target },
501-
false,
502-
);
494+
self.block(vec![], TerminatorKind::Goto { target }, false);
503495
unwind
504496
}
505497

506498
fn tuple_like_shim<I>(&mut self, dest: Place<'tcx>, src: Place<'tcx>, tys: I)
507499
where
508500
I: IntoIterator<Item = Ty<'tcx>>,
509501
{
510-
self.block(
511-
vec![],
512-
TerminatorKind::Goto { target: self.block_index_offset(3) },
513-
false,
514-
);
502+
self.block(vec![], TerminatorKind::Goto { target: self.block_index_offset(3) }, false);
515503
let unwind = self.block(vec![], TerminatorKind::Resume, true);
516504
let target = self.block(vec![], TerminatorKind::Return, false);
517505

@@ -525,11 +513,7 @@ impl<'tcx> CloneShimBuilder<'tcx> {
525513
gen_def_id: DefId,
526514
substs: GeneratorSubsts<'tcx>,
527515
) {
528-
self.block(
529-
vec![],
530-
TerminatorKind::Goto { target: self.block_index_offset(3) },
531-
false,
532-
);
516+
self.block(vec![], TerminatorKind::Goto { target: self.block_index_offset(3) }, false);
533517
let unwind = self.block(vec![], TerminatorKind::Resume, true);
534518
// This will get overwritten with a switch once we know the target blocks
535519
let switch = self.block(vec![], TerminatorKind::Unreachable, false);
@@ -566,7 +550,7 @@ impl<'tcx> CloneShimBuilder<'tcx> {
566550
switch_ty: discr_ty,
567551
targets: SwitchTargets::new(cases.into_iter(), unreachable),
568552
};
569-
},
553+
}
570554
BasicBlockData { terminator: None, .. } => unreachable!(),
571555
}
572556
}

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

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

19401940
ty::Generator(_, substs, hir::Movability::Movable) => {
19411941
if self.tcx().features().generator_clone {
1942-
let resolved_upvars = self.infcx.shallow_resolve(substs.as_generator().tupled_upvars_ty());
1943-
let resolved_witness = self.infcx.shallow_resolve(substs.as_generator().witness());
1942+
let resolved_upvars =
1943+
self.infcx.shallow_resolve(substs.as_generator().tupled_upvars_ty());
1944+
let resolved_witness =
1945+
self.infcx.shallow_resolve(substs.as_generator().witness());
19441946
if {
1945-
matches!(resolved_upvars.kind(), ty::Infer(ty::TyVar(_))) ||
1946-
matches!(resolved_witness.kind(), ty::Infer(ty::TyVar(_)))
1947+
matches!(resolved_upvars.kind(), ty::Infer(ty::TyVar(_)))
1948+
|| matches!(resolved_witness.kind(), ty::Infer(ty::TyVar(_)))
19471949
} {
19481950
// Not yet resolved.
19491951
Ambiguous
@@ -1967,14 +1969,21 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
19671969
if matches!(resolved.kind(), ty::Infer(ty::TyVar(_))) {
19681970
break Ambiguous;
19691971
}
1970-
},
1972+
}
19711973
Option::None => {
19721974
// (*) binder moved here
19731975
let all_vars = self.tcx().mk_bound_variable_kinds(
1974-
obligation.predicate.bound_vars().iter().chain(binder.bound_vars().iter())
1976+
obligation
1977+
.predicate
1978+
.bound_vars()
1979+
.iter()
1980+
.chain(binder.bound_vars().iter()),
19751981
);
1976-
break Where(ty::Binder::bind_with_vars(witness_tys.to_vec(), all_vars));
1977-
},
1982+
break Where(ty::Binder::bind_with_vars(
1983+
witness_tys.to_vec(),
1984+
all_vars,
1985+
));
1986+
}
19781987
}
19791988
}
19801989
}

compiler/rustc_ty_utils/src/instance.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -263,10 +263,10 @@ fn resolve_associated_item<'tcx>(
263263
let is_copy = self_ty.is_copy_modulo_regions(tcx.at(DUMMY_SP), param_env);
264264
match self_ty.kind() {
265265
_ if is_copy => (),
266-
ty::Generator(..) |
267-
ty::GeneratorWitness(..) |
268-
ty::Closure(..) |
269-
ty::Tuple(..) => {},
266+
ty::Generator(..)
267+
| ty::GeneratorWitness(..)
268+
| ty::Closure(..)
269+
| ty::Tuple(..) => {}
270270
_ => return Ok(None),
271271
};
272272

0 commit comments

Comments
 (0)