use crate::utils::{last_path_segment, span_lint_and_help};
use rustc_hir::{
- intravisit, Body, Expr, ExprKind, FieldPat, FnDecl, HirId, LocalSource, MatchSource, Mutability, Pat, PatKind,
+ intravisit, Body, Expr, ExprKind, PatField, FnDecl, HirId, LocalSource, MatchSource, Mutability, Pat, PatKind,
QPath, Stmt, StmtKind,
};
use rustc_lint::{LateContext, LateLintPass, LintContext};
level: Level,
) -> Option<(Span, Mutability, Level)> {
if let PatKind::Ref(ref sub_pat, _) = pat.kind {
- if let TyKind::Ref(_, sub_ty, _) = ty.kind {
+ if let TyKind::Ref(_, sub_ty, _) = ty.kind() {
return find_first_mismatch(cx, sub_pat, sub_ty, Level::Lower);
}
}
- if let TyKind::Ref(_, _, mutability) = ty.kind {
+ if let TyKind::Ref(_, _, mutability) = *ty.kind() {
if is_non_ref_pattern(&pat.kind) {
return Some((pat.span, mutability, level));
}
}
if let PatKind::Struct(ref qpath, ref field_pats, _) = pat.kind {
- if let TyKind::Adt(ref adt_def, ref substs_ref) = ty.kind {
+ if let TyKind::Adt(ref adt_def, ref substs_ref) = ty.kind() {
if let Some(variant) = get_variant(adt_def, qpath) {
let field_defs = &variant.fields;
return find_first_mismatch_in_struct(cx, field_pats, field_defs, substs_ref);
}
if let PatKind::TupleStruct(ref qpath, ref pats, _) = pat.kind {
- if let TyKind::Adt(ref adt_def, ref substs_ref) = ty.kind {
+ if let TyKind::Adt(ref adt_def, ref substs_ref) = ty.kind() {
if let Some(variant) = get_variant(adt_def, qpath) {
let field_defs = &variant.fields;
let ty_iter = field_defs.iter().map(|field_def| field_def.ty(cx.tcx, substs_ref));
}
if let PatKind::Tuple(ref pats, _) = pat.kind {
- if let TyKind::Tuple(..) = ty.kind {
+ if let TyKind::Tuple(..) = ty.kind() {
return find_first_mismatch_in_tuple(cx, pats, ty.tuple_fields());
}
}
fn find_first_mismatch_in_struct<'tcx>(
cx: &LateContext<'tcx>,
- field_pats: &[FieldPat<'_>],
+ field_pats: &[PatField<'_>],
field_defs: &[FieldDef],
substs_ref: SubstsRef<'tcx>,
) -> Option<(Span, Mutability, Level)> {