提交 08f3685a 编写于 作者: V varkor

Remove unnecessary TyKind::s

上级 8a5dccde
......@@ -236,7 +236,7 @@ fn visit_expr(&mut self, expr: &'tcx hir::Expr) {
self.handle_field_access(&lhs, expr.id);
}
hir::ExprKind::Struct(_, ref fields, _) => {
if let ty::TyKind::Adt(ref adt, _) = self.tables.expr_ty(expr).sty {
if let ty::Adt(ref adt, _) = self.tables.expr_ty(expr).sty {
self.mark_as_used_if_union(adt, fields);
}
}
......
......@@ -802,7 +802,7 @@ pub fn report_selection_error(&self,
let expected = match expected_trait_ref.skip_binder().substs.type_at(1).sty {
ty::Tuple(ref tys) => tys.iter()
.map(|t| match t.sty {
ty::TyKind::Tuple(ref tys) => ArgKind::Tuple(
ty::Tuple(ref tys) => ArgKind::Tuple(
Some(span),
tys.iter()
.map(|ty| ("_".to_owned(), ty.sty.to_string()))
......@@ -899,7 +899,7 @@ fn suggest_remove_reference(&self,
let mut trait_type = trait_ref.self_ty();
for refs_remaining in 0..refs_number {
if let ty::TyKind::Ref(_, t_type, _) = trait_type.sty {
if let ty::Ref(_, t_type, _) = trait_type.sty {
trait_type = t_type;
let substs = self.tcx.mk_substs_trait(trait_type, &[]);
......
......@@ -503,7 +503,7 @@ pub fn destructor_constraints(self, def: &'tcx ty::AdtDef)
!impl_generics.region_param(ebr, self).pure_wrt_drop
}
UnpackedKind::Type(&ty::TyS {
sty: ty::TyKind::Param(ref pt), ..
sty: ty::Param(ref pt), ..
}) => {
!impl_generics.type_param(pt, self).pure_wrt_drop
}
......
......@@ -697,7 +697,7 @@ pub fn report_use_of_moved_value(&self,
Some(nl.to_string()),
Origin::Ast);
let need_note = match lp.ty.sty {
ty::TyKind::Closure(id, _) => {
ty::Closure(id, _) => {
let node_id = self.tcx.hir.as_local_node_id(id).unwrap();
let hir_id = self.tcx.hir.node_to_hir_id(node_id);
if let Some((span, name)) = self.tables.closure_kind_origins().get(hir_id) {
......
......@@ -134,7 +134,7 @@ pub(super) fn report_use_of_moved_or_uninitialized(
if let Some(ty) = self.retrieve_type_for_place(place) {
let needs_note = match ty.sty {
ty::TyKind::Closure(id, _) => {
ty::Closure(id, _) => {
let tables = self.tcx.typeck_tables_of(id);
let node_id = self.tcx.hir.as_local_node_id(id).unwrap();
let hir_id = self.tcx.hir.node_to_hir_id(node_id);
......
......@@ -53,7 +53,7 @@ pub fn check_pat_walk(
PatKind::Lit(ref lt) => {
let ty = self.check_expr(lt);
match ty.sty {
ty::TyKind::Ref(..) => false,
ty::Ref(..) => false,
_ => true,
}
}
......@@ -84,7 +84,7 @@ pub fn check_pat_walk(
expected = loop {
debug!("inspecting {:?} with type {:?}", exp_ty, exp_ty.sty);
match exp_ty.sty {
ty::TyKind::Ref(_, inner_ty, inner_mutability) => {
ty::Ref(_, inner_ty, inner_mutability) => {
debug!("current discriminant is Ref, inserting implicit deref");
// Preserve the reference type. We'll need it later during HAIR lowering.
pat_adjustments.push(exp_ty);
......
......@@ -477,12 +477,12 @@ fn do_check(&self, fcx: &FnCtxt<'a, 'gcx, 'tcx>) -> Result<CastKind, CastError>
(RPtr(p), Int(_)) |
(RPtr(p), Float) => {
match p.ty.sty {
ty::TyKind::Int(_) |
ty::TyKind::Uint(_) |
ty::TyKind::Float(_) => {
ty::Int(_) |
ty::Uint(_) |
ty::Float(_) => {
Err(CastError::NeedDeref)
}
ty::TyKind::Infer(t) => {
ty::Infer(t) => {
match t {
ty::InferTy::IntVar(_) |
ty::InferTy::FloatVar(_) => Err(CastError::NeedDeref),
......
......@@ -83,7 +83,7 @@ pub fn get_blanket_impls<F>(
.expect("Cannot get impl trait");
match trait_ref.self_ty().sty {
ty::TyParam(_) => {},
ty::Param(_) => {},
_ => return,
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册