Eliminate PatKind::Path
This commit is contained in:
parent
ccc9ba5c30
commit
f47ad71059
39 changed files with 273 additions and 174 deletions
|
@ -6,7 +6,7 @@ use rustc_hir::def::Res;
|
|||
use rustc_hir::def_id::DefId;
|
||||
use rustc_hir::{
|
||||
AmbigArg, BinOp, BinOpKind, Expr, ExprKind, GenericArg, HirId, Impl, Item, ItemKind, Node, Pat,
|
||||
PatKind, Path, PathSegment, QPath, Ty, TyKind,
|
||||
PatExpr, PatExprKind, PatKind, Path, PathSegment, QPath, Ty, TyKind,
|
||||
};
|
||||
use rustc_middle::ty::{self, GenericArgsRef, Ty as MiddleTy};
|
||||
use rustc_session::{declare_lint_pass, declare_tool_lint};
|
||||
|
@ -164,11 +164,9 @@ impl<'tcx> LateLintPass<'tcx> for TyTyKind {
|
|||
TyKind::Path(QPath::Resolved(_, path)) => {
|
||||
if lint_ty_kind_usage(cx, &path.res) {
|
||||
let span = match cx.tcx.parent_hir_node(ty.hir_id) {
|
||||
Node::Pat(Pat {
|
||||
kind:
|
||||
PatKind::Path(qpath)
|
||||
| PatKind::TupleStruct(qpath, ..)
|
||||
| PatKind::Struct(qpath, ..),
|
||||
Node::PatExpr(PatExpr { kind: PatExprKind::Path(qpath), .. })
|
||||
| Node::Pat(Pat {
|
||||
kind: PatKind::TupleStruct(qpath, ..) | PatKind::Struct(qpath, ..),
|
||||
..
|
||||
})
|
||||
| Node::Expr(
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
use rustc_abi::ExternAbi;
|
||||
use rustc_hir::def::{DefKind, Res};
|
||||
use rustc_hir::intravisit::FnKind;
|
||||
use rustc_hir::{AttrArgs, AttrItem, AttrKind, GenericParamKind, PatKind};
|
||||
use rustc_hir::{AttrArgs, AttrItem, AttrKind, GenericParamKind, PatExprKind, PatKind};
|
||||
use rustc_middle::ty;
|
||||
use rustc_session::config::CrateType;
|
||||
use rustc_session::{declare_lint, declare_lint_pass};
|
||||
|
@ -527,7 +527,11 @@ impl<'tcx> LateLintPass<'tcx> for NonUpperCaseGlobals {
|
|||
|
||||
fn check_pat(&mut self, cx: &LateContext<'_>, p: &hir::Pat<'_>) {
|
||||
// Lint for constants that look like binding identifiers (#7526)
|
||||
if let PatKind::Path(hir::QPath::Resolved(None, path)) = p.kind {
|
||||
if let PatKind::Expr(hir::PatExpr {
|
||||
kind: PatExprKind::Path(hir::QPath::Resolved(None, path)),
|
||||
..
|
||||
}) = p.kind
|
||||
{
|
||||
if let Res::Def(DefKind::Const, _) = path.res {
|
||||
if let [segment] = path.segments {
|
||||
NonUpperCaseGlobals::check_upper_case(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue