about summary refs log tree commit diff
diff options
context:
space:
mode:
authorAndrew Cann <shum@canndrew.org>2022-03-21 12:57:06 +0800
committerCharles Lew <crlf0710@gmail.com>2022-09-11 14:04:16 +0800
commit22f4bbb20f373b0c3d47788f58c95d60656918f2 (patch)
tree478ff4f6dae1a7afb05ce002c71bbb5bb1fd1dca
parent8aa30dd3cb18e4e6a1a5940addd8e744ab8d3eef (diff)
downloadrust-22f4bbb20f373b0c3d47788f58c95d60656918f2.tar.gz
rust-22f4bbb20f373b0c3d47788f58c95d60656918f2.zip
Apply formatting fixes
-rw-r--r--compiler/rustc_mir_transform/src/shim.rs28
-rw-r--r--compiler/rustc_trait_selection/src/traits/select/mod.rs25
-rw-r--r--compiler/rustc_ty_utils/src/instance.rs8
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_hir::lang_items::LangItem;
 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 @@ impl<'tcx> CloneShimBuilder<'tcx> {
             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 @@ impl<'tcx> CloneShimBuilder<'tcx> {
     where
         I: IntoIterator<Item = Ty<'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);
         let target = self.block(vec![], TerminatorKind::Return, false);
 
@@ -525,11 +513,7 @@ impl<'tcx> CloneShimBuilder<'tcx> {
         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 @@ impl<'tcx> CloneShimBuilder<'tcx> {
                     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 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
 
             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 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
                             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),
                     };