Skip to content

Commit 3ef1dab

Browse files
committed
1 parent 34763a5 commit 3ef1dab

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

clippy_lints/src/methods/mod.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -3425,12 +3425,12 @@ enum SelfKind {
34253425

34263426
impl SelfKind {
34273427
fn matches<'a>(self, cx: &LateContext<'_, 'a>, parent_ty: Ty<'a>, ty: Ty<'a>) -> bool {
3428-
fn matches_value(parent_ty: Ty<'_>, ty: Ty<'_>) -> bool {
3428+
fn matches_value<'a>(cx: &LateContext<'_, 'a>, parent_ty: Ty<'_>, ty: Ty<'_>) -> bool {
34293429
if ty == parent_ty {
34303430
true
34313431
} else if ty.is_box() {
34323432
ty.boxed_ty() == parent_ty
3433-
} else if ty.is_rc() || ty.is_arc() {
3433+
} else if is_type_diagnostic_item(cx, ty, sym::Rc) || is_type_diagnostic_item(cx, ty, sym::Arc) {
34343434
if let ty::Adt(_, substs) = ty.kind {
34353435
substs.types().next().map_or(false, |t| t == parent_ty)
34363436
} else {
@@ -3464,7 +3464,7 @@ impl SelfKind {
34643464
}
34653465

34663466
match self {
3467-
Self::Value => matches_value(parent_ty, ty),
3467+
Self::Value => matches_value(cx, parent_ty, ty),
34683468
Self::Ref => matches_ref(cx, hir::Mutability::Not, parent_ty, ty) || ty == parent_ty && is_copy(cx, ty),
34693469
Self::RefMut => matches_ref(cx, hir::Mutability::Mut, parent_ty, ty),
34703470
Self::No => ty != parent_ty,

clippy_lints/src/types.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -347,7 +347,7 @@ impl Types {
347347
);
348348
return; // don't recurse into the type
349349
}
350-
} else if Some(def_id) == cx.tcx.lang_items().rc() {
350+
} else if cx.tcx.is_diagnostic_item(sym::Rc, def_id) {
351351
if let Some(span) = match_type_parameter(cx, qpath, &paths::RC) {
352352
span_lint_and_sugg(
353353
cx,

0 commit comments

Comments
 (0)