Use TyS::same_type

This commit is contained in:
Cameron Steffen 2021-02-09 19:42:32 -06:00 committed by flip1995
parent 7f61ddd5b8
commit 52f98d832d
No known key found for this signature in database
GPG key ID: 1CA0DF2AF59D68A5

View file

@ -13,7 +13,7 @@ use rustc_hir::{
}; };
use rustc_lint::{LateContext, LateLintPass, LintContext}; use rustc_lint::{LateContext, LateLintPass, LintContext};
use rustc_middle::hir::map::Map; use rustc_middle::hir::map::Map;
use rustc_middle::ty::{AssocKind, Ty}; use rustc_middle::ty::{AssocKind, Ty, TyS};
use rustc_semver::RustcVersion; use rustc_semver::RustcVersion;
use rustc_session::{declare_tool_lint, impl_lint_pass}; use rustc_session::{declare_tool_lint, impl_lint_pass};
use rustc_span::{BytePos, Span}; use rustc_span::{BytePos, Span};
@ -452,7 +452,7 @@ fn in_impl(cx: &LateContext<'tcx>, hir_ty: &hir::Ty<'_>) -> bool {
fn should_lint_ty(hir_ty: &hir::Ty<'_>, ty: Ty<'_>, self_ty: Ty<'_>) -> bool { fn should_lint_ty(hir_ty: &hir::Ty<'_>, ty: Ty<'_>, self_ty: Ty<'_>) -> bool {
if_chain! { if_chain! {
if ty == self_ty; if TyS::same_type(ty, self_ty);
if let TyKind::Path(QPath::Resolved(_, path)) = hir_ty.kind; if let TyKind::Path(QPath::Resolved(_, path)) = hir_ty.kind;
then { then {
!matches!(path.res, def::Res::SelfTy(..)) !matches!(path.res, def::Res::SelfTy(..))