mirror of
https://github.com/rust-lang/rust.git
synced 2026-05-21 17:52:12 +03:00
Fix bug in TyKind lint
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
//! Some lints that are only useful in the compiler or crates that use compiler internals, such as
|
||||
//! Clippy.
|
||||
|
||||
use crate::hir::{HirId, Path, QPath, Ty, TyKind};
|
||||
use crate::hir::{def::Def, HirId, Path, QPath, Ty, TyKind};
|
||||
use crate::lint::{
|
||||
EarlyContext, EarlyLintPass, LateContext, LateLintPass, LintArray, LintContext, LintPass,
|
||||
};
|
||||
@@ -92,10 +92,12 @@ fn check_path(&mut self, cx: &LateContext<'_, '_>, path: &'tcx Path, _: HirId) {
|
||||
segments: segments_iter.cloned().collect(),
|
||||
};
|
||||
|
||||
if let Some(def) = last.def {
|
||||
if def
|
||||
.def_id()
|
||||
.match_path(cx.tcx, &["rustc", "ty", "sty", "TyKind"])
|
||||
match last.def {
|
||||
Some(Def::Err) => (),
|
||||
Some(def)
|
||||
if def
|
||||
.def_id()
|
||||
.match_path(cx.tcx, &["rustc", "ty", "sty", "TyKind"]) =>
|
||||
{
|
||||
cx.struct_span_lint(
|
||||
USAGE_OF_TY_TYKIND,
|
||||
@@ -110,6 +112,7 @@ fn check_path(&mut self, cx: &LateContext<'_, '_>, path: &'tcx Path, _: HirId) {
|
||||
)
|
||||
.emit();
|
||||
}
|
||||
_ => (),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user