From 22f4bbb20f373b0c3d47788f58c95d60656918f2 Mon Sep 17 00:00:00 2001 From: Andrew Cann Date: Mon, 21 Mar 2022 12:57:06 +0800 Subject: [PATCH] Apply formatting fixes --- compiler/rustc_mir_transform/src/shim.rs | 28 ++++--------------- .../src/traits/select/mod.rs | 25 +++++++++++------ compiler/rustc_ty_utils/src/instance.rs | 8 +++--- 3 files changed, 27 insertions(+), 34 deletions(-) diff --git a/compiler/rustc_mir_transform/src/shim.rs b/compiler/rustc_mir_transform/src/shim.rs index 0be2cbb2094..3a43932f50c 100644 --- a/compiler/rustc_mir_transform/src/shim.rs +++ b/compiler/rustc_mir_transform/src/shim.rs @@ -4,7 +4,7 @@ use rustc_middle::mir::*; use rustc_middle::ty::query::Providers; use rustc_middle::ty::subst::{InternalSubsts, Subst}; -use rustc_middle::ty::{self, EarlyBinder, Ty, TyCtxt, GeneratorSubsts}; +use rustc_middle::ty::{self, EarlyBinder, GeneratorSubsts, Ty, TyCtxt}; use rustc_target::abi::VariantIdx; use rustc_index::vec::{Idx, IndexVec}; @@ -486,20 +486,12 @@ fn clone_fields( self.make_clone_call(dest_field, src_field, ity, next_block, unwind); self.block( vec![], - TerminatorKind::Drop { - place: dest_field, - target: unwind, - unwind: None, - }, + TerminatorKind::Drop { place: dest_field, target: unwind, unwind: None }, true, ); unwind = next_unwind; } - self.block( - vec![], - TerminatorKind::Goto { target }, - false, - ); + self.block(vec![], TerminatorKind::Goto { target }, false); unwind } @@ -507,11 +499,7 @@ fn tuple_like_shim(&mut self, dest: Place<'tcx>, src: Place<'tcx>, tys: I) where I: IntoIterator>, { - self.block( - vec![], - TerminatorKind::Goto { target: self.block_index_offset(3) }, - false, - ); + self.block(vec![], TerminatorKind::Goto { target: self.block_index_offset(3) }, false); let unwind = self.block(vec![], TerminatorKind::Resume, true); let target = self.block(vec![], TerminatorKind::Return, false); @@ -525,11 +513,7 @@ fn generator_shim( gen_def_id: DefId, substs: GeneratorSubsts<'tcx>, ) { - self.block( - vec![], - TerminatorKind::Goto { target: self.block_index_offset(3) }, - false, - ); + self.block(vec![], TerminatorKind::Goto { target: self.block_index_offset(3) }, false); let unwind = self.block(vec![], TerminatorKind::Resume, true); // This will get overwritten with a switch once we know the target blocks let switch = self.block(vec![], TerminatorKind::Unreachable, false); @@ -566,7 +550,7 @@ fn generator_shim( switch_ty: discr_ty, targets: SwitchTargets::new(cases.into_iter(), unreachable), }; - }, + } BasicBlockData { terminator: None, .. } => unreachable!(), } } diff --git a/compiler/rustc_trait_selection/src/traits/select/mod.rs b/compiler/rustc_trait_selection/src/traits/select/mod.rs index 3499c64a1db..b5e7a8b562e 100644 --- a/compiler/rustc_trait_selection/src/traits/select/mod.rs +++ b/compiler/rustc_trait_selection/src/traits/select/mod.rs @@ -1939,11 +1939,13 @@ fn copy_clone_conditions( ty::Generator(_, substs, hir::Movability::Movable) => { if self.tcx().features().generator_clone { - let resolved_upvars = self.infcx.shallow_resolve(substs.as_generator().tupled_upvars_ty()); - let resolved_witness = self.infcx.shallow_resolve(substs.as_generator().witness()); + let resolved_upvars = + self.infcx.shallow_resolve(substs.as_generator().tupled_upvars_ty()); + let resolved_witness = + self.infcx.shallow_resolve(substs.as_generator().witness()); if { - matches!(resolved_upvars.kind(), ty::Infer(ty::TyVar(_))) || - matches!(resolved_witness.kind(), ty::Infer(ty::TyVar(_))) + matches!(resolved_upvars.kind(), ty::Infer(ty::TyVar(_))) + || matches!(resolved_witness.kind(), ty::Infer(ty::TyVar(_))) } { // Not yet resolved. Ambiguous @@ -1967,14 +1969,21 @@ fn copy_clone_conditions( if matches!(resolved.kind(), ty::Infer(ty::TyVar(_))) { break Ambiguous; } - }, + } Option::None => { // (*) binder moved here let all_vars = self.tcx().mk_bound_variable_kinds( - obligation.predicate.bound_vars().iter().chain(binder.bound_vars().iter()) + obligation + .predicate + .bound_vars() + .iter() + .chain(binder.bound_vars().iter()), ); - break Where(ty::Binder::bind_with_vars(witness_tys.to_vec(), all_vars)); - }, + break Where(ty::Binder::bind_with_vars( + witness_tys.to_vec(), + all_vars, + )); + } } } } diff --git a/compiler/rustc_ty_utils/src/instance.rs b/compiler/rustc_ty_utils/src/instance.rs index 87eca3d388b..edf47403c0d 100644 --- a/compiler/rustc_ty_utils/src/instance.rs +++ b/compiler/rustc_ty_utils/src/instance.rs @@ -263,10 +263,10 @@ fn resolve_associated_item<'tcx>( let is_copy = self_ty.is_copy_modulo_regions(tcx.at(DUMMY_SP), param_env); match self_ty.kind() { _ if is_copy => (), - ty::Generator(..) | - ty::GeneratorWitness(..) | - ty::Closure(..) | - ty::Tuple(..) => {}, + ty::Generator(..) + | ty::GeneratorWitness(..) + | ty::Closure(..) + | ty::Tuple(..) => {} _ => return Ok(None), };